Mình tìm hoài có cách lấy dữ liệu từ Excel lên Word form. Có bạn nào có cách ngược lại lấy dữ liệu từ Word form vào Excel thì share cho mình với!
thanks
Mình tìm hoài có cách lấy dữ liệu từ Excel lên Word form. Có bạn nào có cách ngược lại lấy dữ liệu từ Word form vào Excel thì share cho mình với!
thanks
Mình tìm hoài có cách lấy dữ liệu từ Excel lên Word form. Có bạn nào có cách ngược lại lấy dữ liệu từ Word form vào Excel thì share cho mình với!
thanks
Function GetAllTextFormField(document As Object)
' đoňc thông tin vęĚ tâět caŇ caěc Text Form Field trong văn baŇn document
' haĚm traŇ vęĚ maŇng coě 2 côňt. Côňt 1 laĚ TĘN, côňt 2 laĚ giaě triň. TĘN naĚy lâěy őŇ đâu? Nęěu ta đuěp chuôňt lęn Text Form Field hoăňc chuôňt phaŇi
' rôĚi choňn Properties thiĚ TĘN őŇ ô Bookmark chiěnh laĚ TĘN câĚn tiĚm
Dim count As Long, aField As Object, Arr, r As Long
On Error Resume Next
count = document.FormFields.count
ReDim Arr(1 To count, 1 To 2)
For Each aField In document.FormFields
r = r + 1
Arr(r, 1) = aField.Name
Arr(r, 2) = aField.result
Next
GetAllTextFormField = Arr
End Function
Function GetTextFormField(document As Object, index) As String
' haĚm traŇ vęĚ giaě triň cuŇa Text Form Field xaěc điňnh bőŇi index trong văn baŇn document
' index coě thęŇ laĚ sôě thýě týň cuŇa Text Form Field hoăňc TĘN
On Error Resume Next
GetTextFormField = document.FormFields(index).result
End Function
Sub SetTextFormField(document As Object, index, ByVal text As String)
' thięět lâňp giaě triň cho Text Form Field xaěc điňnh bőŇi index trong văn baŇn document
' index coě thęŇ laĚ sôě thýě týň cuŇa Text Form Field hoăňc TĘN
On Error Resume Next
document.FormFields(index).result = text
End Sub
Bạn có thể cho mình hỏi là:Chuyện đọc hay ghi cái gì đó không khó. Nhưng phải biết đọc ở đâu, ghi ở đâu. Nói cách khác cần phải biết gán cái "mác" cho ai hoặc đọc cái "mác" đó từ ai.
Mã:Function GetAllTextFormField(document As Object) ' đoňc thông tin vęĚ tâět caŇ caěc Text Form Field trong văn baŇn document ' haĚm traŇ vęĚ maŇng coě 2 côňt. Côňt 1 laĚ TĘN, côňt 2 laĚ giaě triň. TĘN naĚy lâěy őŇ đâu? Nęěu ta đuěp chuôňt lęn Text Form Field hoăňc chuôňt phaŇi ' rôĚi choňn Properties thiĚ TĘN őŇ ô Bookmark chiěnh laĚ TĘN câĚn tiĚm Dim count As Long, aField As Object, Arr, r As Long On Error Resume Next count = document.FormFields.count ReDim Arr(1 To count, 1 To 2) For Each aField In document.FormFields r = r + 1 Arr(r, 1) = aField.Name Arr(r, 2) = aField.result Next GetAllTextFormField = Arr End Function Function GetTextFormField(document As Object, index) As String ' haĚm traŇ vęĚ giaě triň cuŇa Text Form Field xaěc điňnh bőŇi index trong văn baŇn document ' index coě thęŇ laĚ sôě thýě týň cuŇa Text Form Field hoăňc TĘN On Error Resume Next GetTextFormField = document.FormFields(index).result End Function Sub SetTextFormField(document As Object, index, ByVal text As String) ' thięět lâňp giaě triň cho Text Form Field xaěc điňnh bőŇi index trong văn baŇn document ' index coě thęŇ laĚ sôě thýě týň cuŇa Text Form Field hoăňc TĘN On Error Resume Next document.FormFields(index).result = text End Sub
DIỄN ĐÀN GIẢI PHÁP EXCEL Group 1
DIỄN ĐÀN GIẢI PHÁP EXCEL Group 2