Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Reading Field Forms w/ Blank Bookmarks
My office has several hundred copies of a Word form that has been populated
over the past year as a way of tracking individual projects. Each form has a couple dozen fields, most of which have bookmarks but a few which have the bookmark field blank. I would like to retrieve and consolidate the data in the fields and I found Greg Maxey's macro to do this into Access. Is it possible to do this for the form fields that do not have a bookmark valule? Thanks in advance for any help. ed |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Reading Field Forms w/ Blank Bookmarks
Hi expect_ed,
Provided all the documents have the same layout and number of formfields (ie there's no gaps in or extras added to the set of fields), you can extract the data by simply iterating through the formfield collection. You don't need to know the bookmark names unless you're after a particular formfield and you don't want to have to remember its position in the document. For example: Sub Demo() Dim oFld As FormField With ActiveDocument For Each oFld In .FormFields MsgBox oFld.Result Next oFld End With End Sub For checkbox formfields, the 'result' will be 1 (True) or 0 (False). Obviously, you'll need to replace the messagebox with the relevant output code and call the above routine from whatever code you're using to loop through the documents. -- Cheers macropod [Microsoft MVP - Word] "expect_ed" wrote in message ... My office has several hundred copies of a Word form that has been populated over the past year as a way of tracking individual projects. Each form has a couple dozen fields, most of which have bookmarks but a few which have the bookmark field blank. I would like to retrieve and consolidate the data in the fields and I found Greg Maxey's macro to do this into Access. Is it possible to do this for the form fields that do not have a bookmark valule? Thanks in advance for any help. ed |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Reading Field Forms w/ Blank Bookmarks
Thanks, this is a big help.
Only problem is, if the formfield is blank I get the error: Run-time error '5825': Object has been deleted. Seems I need some sort of error capturing/ignoring routine there but I have no idea how to start setting one up. Any help appreciated. ed "macropod" wrote: Hi expect_ed, Provided all the documents have the same layout and number of formfields (ie there's no gaps in or extras added to the set of fields), you can extract the data by simply iterating through the formfield collection. You don't need to know the bookmark names unless you're after a particular formfield and you don't want to have to remember its position in the document. For example: Sub Demo() Dim oFld As FormField With ActiveDocument For Each oFld In .FormFields MsgBox oFld.Result Next oFld End With End Sub For checkbox formfields, the 'result' will be 1 (True) or 0 (False). Obviously, you'll need to replace the messagebox with the relevant output code and call the above routine from whatever code you're using to loop through the documents. -- Cheers macropod [Microsoft MVP - Word] "expect_ed" wrote in message ... My office has several hundred copies of a Word form that has been populated over the past year as a way of tracking individual projects. Each form has a couple dozen fields, most of which have bookmarks but a few which have the bookmark field blank. I would like to retrieve and consolidate the data in the fields and I found Greg Maxey's macro to do this into Access. Is it possible to do this for the form fields that do not have a bookmark valule? Thanks in advance for any help. ed |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Reading Field Forms w/ Blank Bookmarks
Hi expect_ed,
I'm unable to reproduce that behaviour, even if the formfield is blank. What type of formfield? Is it located in a textbox, table or a normal paragraph? -- Cheers macropod [Microsoft MVP - Word] "expect_ed" wrote in message ... Thanks, this is a big help. Only problem is, if the formfield is blank I get the error: Run-time error '5825': Object has been deleted. Seems I need some sort of error capturing/ignoring routine there but I have no idea how to start setting one up. Any help appreciated. ed "macropod" wrote: Hi expect_ed, Provided all the documents have the same layout and number of formfields (ie there's no gaps in or extras added to the set of fields), you can extract the data by simply iterating through the formfield collection. You don't need to know the bookmark names unless you're after a particular formfield and you don't want to have to remember its position in the document. For example: Sub Demo() Dim oFld As FormField With ActiveDocument For Each oFld In .FormFields MsgBox oFld.Result Next oFld End With End Sub For checkbox formfields, the 'result' will be 1 (True) or 0 (False). Obviously, you'll need to replace the messagebox with the relevant output code and call the above routine from whatever code you're using to loop through the documents. -- Cheers macropod [Microsoft MVP - Word] "expect_ed" wrote in message ... My office has several hundred copies of a Word form that has been populated over the past year as a way of tracking individual projects. Each form has a couple dozen fields, most of which have bookmarks but a few which have the bookmark field blank. I would like to retrieve and consolidate the data in the fields and I found Greg Maxey's macro to do this into Access. Is it possible to do this for the form fields that do not have a bookmark valule? Thanks in advance for any help. ed |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Reading Field Forms w/ Blank Bookmarks
The one I happened to be a date field, or rather Text Form Field of type
Date. Unlimited length formatted MM/dd/yyyy and bookmarked as Text 24. What is strange is that when viewing the form the field is only about the width of a period. If I enter a date and then delete it I cannot get it to go back to the same state. Rather it shows the normal circles of a more typical entry field. Not sure how it got that way but I managed to work around it by adding an "On Error Resume Next" command at the point between setting temp = oFld.Result and Range("A2").Offset(x,y) = temp. "macropod" wrote: Hi expect_ed, I'm unable to reproduce that behaviour, even if the formfield is blank. What type of formfield? Is it located in a textbox, table or a normal paragraph? -- Cheers macropod [Microsoft MVP - Word] "expect_ed" wrote in message ... Thanks, this is a big help. Only problem is, if the formfield is blank I get the error: Run-time error '5825': Object has been deleted. Seems I need some sort of error capturing/ignoring routine there but I have no idea how to start setting one up. Any help appreciated. ed "macropod" wrote: Hi expect_ed, Provided all the documents have the same layout and number of formfields (ie there's no gaps in or extras added to the set of fields), you can extract the data by simply iterating through the formfield collection. You don't need to know the bookmark names unless you're after a particular formfield and you don't want to have to remember its position in the document. For example: Sub Demo() Dim oFld As FormField With ActiveDocument For Each oFld In .FormFields MsgBox oFld.Result Next oFld End With End Sub For checkbox formfields, the 'result' will be 1 (True) or 0 (False). Obviously, you'll need to replace the messagebox with the relevant output code and call the above routine from whatever code you're using to loop through the documents. -- Cheers macropod [Microsoft MVP - Word] "expect_ed" wrote in message ... My office has several hundred copies of a Word form that has been populated over the past year as a way of tracking individual projects. Each form has a couple dozen fields, most of which have bookmarks but a few which have the bookmark field blank. I would like to retrieve and consolidate the data in the fields and I found Greg Maxey's macro to do this into Access. Is it possible to do this for the form fields that do not have a bookmark valule? Thanks in advance for any help. ed |
#6
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Reading Field Forms w/ Blank Bookmarks
Hi expect_ed,
With 'On Error Resume Next', be aware that may mean the rest of the collected data will be offset by one position from where it should be. Better to build in an error-handling routine that deals with the errors more gracefully than that. -- Cheers macropod [Microsoft MVP - Word] "expect_ed" wrote in message ... The one I happened to be a date field, or rather Text Form Field of type Date. Unlimited length formatted MM/dd/yyyy and bookmarked as Text 24. What is strange is that when viewing the form the field is only about the width of a period. If I enter a date and then delete it I cannot get it to go back to the same state. Rather it shows the normal circles of a more typical entry field. Not sure how it got that way but I managed to work around it by adding an "On Error Resume Next" command at the point between setting temp = oFld.Result and Range("A2").Offset(x,y) = temp. "macropod" wrote: Hi expect_ed, I'm unable to reproduce that behaviour, even if the formfield is blank. What type of formfield? Is it located in a textbox, table or a normal paragraph? -- Cheers macropod [Microsoft MVP - Word] "expect_ed" wrote in message ... Thanks, this is a big help. Only problem is, if the formfield is blank I get the error: Run-time error '5825': Object has been deleted. Seems I need some sort of error capturing/ignoring routine there but I have no idea how to start setting one up. Any help appreciated. ed "macropod" wrote: Hi expect_ed, Provided all the documents have the same layout and number of formfields (ie there's no gaps in or extras added to the set of fields), you can extract the data by simply iterating through the formfield collection. You don't need to know the bookmark names unless you're after a particular formfield and you don't want to have to remember its position in the document. For example: Sub Demo() Dim oFld As FormField With ActiveDocument For Each oFld In .FormFields MsgBox oFld.Result Next oFld End With End Sub For checkbox formfields, the 'result' will be 1 (True) or 0 (False). Obviously, you'll need to replace the messagebox with the relevant output code and call the above routine from whatever code you're using to loop through the documents. -- Cheers macropod [Microsoft MVP - Word] "expect_ed" wrote in message ... My office has several hundred copies of a Word form that has been populated over the past year as a way of tracking individual projects. Each form has a couple dozen fields, most of which have bookmarks but a few which have the bookmark field blank. I would like to retrieve and consolidate the data in the fields and I found Greg Maxey's macro to do this into Access. Is it possible to do this for the form fields that do not have a bookmark valule? Thanks in advance for any help. ed |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
user forms and bookmarks | Microsoft Word Help | |||
Reading data from form field | Microsoft Word Help | |||
Forms Bookmarks If Statements | Microsoft Word Help | |||
print field data only for forms option prints a blank page | Microsoft Word Help | |||
Supress the blank space from a blank data field? | Mailmerge |