Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to I import word form fields in excel
I have created a word form which will be completed by several users. How do
I import specific fields from completed forms into excel. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to I import word form fields in excel
Hi Richard,
Hope this helps. It is a little sample of both writing to word document variables and getting the values from them. Sub Get_DocVariable() Dim PathFileName Dim objWord Dim Variable1 Dim Variable2 PathFileName = CurDir & "\" & "DocVariable Copy Test.doc" Set objWord = CreateObject("Word.Application") With objWord .Documents.Open PathFileName .Visible = True 'Write data to a Word document DocVariable .ActiveDocument.Variables("MyDocVariable1") = "Data in my first Variable" .ActiveDocument.Variables("MyDocVariable2") = "Data in my Second Variable" 'Get data from a Word document DocVariable Variable1 = .ActiveDocument.Variables("MyDocVariable1") Variable2 = .ActiveDocument.Variables("MyDocVariable2") End With MsgBox "MyDocVariable1 = " & Variable1 & Chr(13) & _ "MyDocVariable1 = " & Variable2 End Sub -- Regards, OssieMac "Richard" wrote: I have created a word form which will be completed by several users. How do I import specific fields from completed forms into excel. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to I import word form fields in excel
Hi again Richard,
I think that my answer is probably misleading for what you want to achieve. I assume that your word document has FormText fields for the user to insert data and the example does not work on them. -- Regards, OssieMac "OssieMac" wrote: Hi Richard, Hope this helps. It is a little sample of both writing to word document variables and getting the values from them. Sub Get_DocVariable() Dim PathFileName Dim objWord Dim Variable1 Dim Variable2 PathFileName = CurDir & "\" & "DocVariable Copy Test.doc" Set objWord = CreateObject("Word.Application") With objWord .Documents.Open PathFileName .Visible = True 'Write data to a Word document DocVariable .ActiveDocument.Variables("MyDocVariable1") = "Data in my first Variable" .ActiveDocument.Variables("MyDocVariable2") = "Data in my Second Variable" 'Get data from a Word document DocVariable Variable1 = .ActiveDocument.Variables("MyDocVariable1") Variable2 = .ActiveDocument.Variables("MyDocVariable2") End With MsgBox "MyDocVariable1 = " & Variable1 & Chr(13) & _ "MyDocVariable1 = " & Variable2 End Sub -- Regards, OssieMac "Richard" wrote: I have created a word form which will be completed by several users. How do I import specific fields from completed forms into excel. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to I import word form fields in excel
Hi yet again Richard,
After my previous effort which I now think was not what you are looking for I felt bound to have another look at the problem and perhaps the following might help. It does assume that you are using FormText fields for the user to complete with the form protected. If the form is not protected when the user fills in the data, the field names disappear. You then need to unprotect the document to run the code or it cannot select the data. If anyone has a better answer then feel free to post it because I am also interested. Sub Get_FormText() Dim PathFileName Dim objWord Dim Variable1 Dim Variable2 PathFileName = CurDir & "\" & "DocVariable Copy Test.doc" Set objWord = CreateObject("Word.Application") With objWord .Documents.Open PathFileName .Visible = True 'Get data from a Word document DocVariable .ActiveDocument.bookmarks("Text1").Select Variable1 = .Selection .ActiveDocument.bookmarks("Text2").Select Variable2 = .Selection End With MsgBox "Text1 = " & Variable1 & Chr(13) & _ "Text2 = " & Variable2 End Sub -- Regards, OssieMac "OssieMac" wrote: Hi again Richard, I think that my answer is probably misleading for what you want to achieve. I assume that your word document has FormText fields for the user to insert data and the example does not work on them. -- Regards, OssieMac "OssieMac" wrote: Hi Richard, Hope this helps. It is a little sample of both writing to word document variables and getting the values from them. Sub Get_DocVariable() Dim PathFileName Dim objWord Dim Variable1 Dim Variable2 PathFileName = CurDir & "\" & "DocVariable Copy Test.doc" Set objWord = CreateObject("Word.Application") With objWord .Documents.Open PathFileName .Visible = True 'Write data to a Word document DocVariable .ActiveDocument.Variables("MyDocVariable1") = "Data in my first Variable" .ActiveDocument.Variables("MyDocVariable2") = "Data in my Second Variable" 'Get data from a Word document DocVariable Variable1 = .ActiveDocument.Variables("MyDocVariable1") Variable2 = .ActiveDocument.Variables("MyDocVariable2") End With MsgBox "MyDocVariable1 = " & Variable1 & Chr(13) & _ "MyDocVariable1 = " & Variable2 End Sub -- Regards, OssieMac "Richard" wrote: I have created a word form which will be completed by several users. How do I import specific fields from completed forms into excel. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Import text from Word Form to Excel | Excel Discussion (Misc queries) | |||
Excel to input fields into a Word Form | Excel Worksheet Functions | |||
How to Transfer data from Text Form Fields in MS Word into Excel? | Excel Discussion (Misc queries) | |||
Put form fields in Word forms into an Excel spreadsheet? | Excel Discussion (Misc queries) | |||
can we link fields from a form in word document to excel | Excel Discussion (Misc queries) |