Lon Posted November 2, 2005 Report Share Posted November 2, 2005 Can anyone tell me if Macro Express can look through a Word (2003) document and locate a particular "FormText" (in this case known as "Text60) field or fields and copy their contents as variables? I have several documents that need common information shared between them (not always the same documents). The documents are already designed with the "formtext" fields. I am just looking for the possibilities of extracting information from certain fields I have filled out and having that information ready to paste into the next form when I open it and envoke the macro to populate the common fields, etc. There are too many check boxes and other field codes to use a "tab" method but the field code names are specific. I haven't found a successful way do deal with Word to export values out of a document to be later used for recall. Thanks for your ideas. Quote Link to comment Share on other sites More sharing options...
kevin Posted November 2, 2005 Report Share Posted November 2, 2005 Hi Lon, Macro Express does not have any commands to understand the binary format of a Word document. You can read the content of a Word document file into a string (T1) variable and you may be able to examine the contents of that variable. But, because the string variables are meant for Text, not binary, you may have problems reading the binary data this way. (I recall one customer having trouble but I do not recall the details.) Quote Link to comment Share on other sites More sharing options...
randallc Posted November 3, 2005 Report Share Posted November 3, 2005 Hi, I have successfully run macros in word which send info to MEX text strings. If you can record a Word macro to record the info you want first, this could be run and the info sent? I have not made a macro looking for field name content, but I bet it is possible. Best, Randall Quote Link to comment Share on other sites More sharing options...
randallc Posted November 7, 2005 Report Share Posted November 7, 2005 Hi, here's a non-guaranteed Word macro which calls the next NMEX3 macro at the end; Sub fieldfind()'To do it simply, set this macro to a toolbar menu which you can get from MEx3 ' by simple key presses; at the end, it will call your macro to continue 'and recover the strings from the registry entries you have made ' At least to give an idea..... Dim MacEx3, strSection, strPicker, strDestination strSection = "HKEY_CURRENT_USER\Software\Professional Grade Macros" _ & "\PGM Functions\Swap" Selection.HomeKey Unit:=wdStory, Extend:=wdMove ActiveDocument.Fields.Update Do While Not (Selection.NextField Is Nothing) fieldNumber = fieldNumber + 1 System.PrivateProfileString("", strSection, _ "Field" + fieldNumber) = Selection 'MsgBox (Selection) Loop MacEx3 = "c:\program files\macro express3\" On Error Resume Next Shell (MacEx3 + "meproc.exe /ARetrieverFromRegistryMacro") End Sub What do you think? Randall Quote Link to comment Share on other sites More sharing options...
randallc Posted November 8, 2005 Report Share Posted November 8, 2005 Hi, more simply, try; Write in macro express; 1. activate word window, appropriate document (form) 2. CRL-G -"goto" -wait etc; <ACTIVATE2:- Microsoft Word><REM2:1st field "text1" ?><TEXTTYPE:<CONTROL>g><WAITWIN2:000010:000000:Find and Replace><TEXTTYPE:Text1<ENTER>><IMSD:30><TEXTTYPE:Text4<ENTER>><WCLS:Find and Replace><WAITWLF2:000010:000000:Find and Replace><CLIPC><TVAR2:01:03:><REM2:2nd field "text2" ?><TEXTTYPE:<CONTROL>g><WAITWIN2:000010:000000:Find and Replace><TEXTTYPE:Text4<ENTER>><IMSD:30><TEXTTYPE:Text4<ENTER>><WCLS:Find and Replace><WAITWLF2:000010:000000:Find and Replace><CLIPC><TVAR2:02:03:><REM2:3rd field "text3" ? etc> Activate Window: "- Microsoft Word"// 1st field "text1" ? Text Type: <CONTROL>g Wait For Window Title: "Find and Replace" Text Type: Text1<ENTER> Delay 30 Milliseconds Text Type: Text4<ENTER> Window Close: "Find and Replace" Wait Window Lose Focus: "Find and Replace" Clipboard Copy Variable Set String %T1% from Clipboard // 2nd field "text2" ? Text Type: <CONTROL>g Wait For Window Title: "Find and Replace" Text Type: Text4<ENTER> Delay 30 Milliseconds Text Type: Text4<ENTER> Window Close: "Find and Replace" Wait Window Lose Focus: "Find and Replace" Clipboard Copy Variable Set String %T2% from Clipboard // 3rd field "text3" ? etc All this macro would do would be to copy the content; but you could get the properties too to strings by opening that box in your picture once you are there; Text Type: <APP>rWait For Window Title: "Text Form Field Options" Text Type: <ALT>e<CONTROL>c Variable Set String %T3% from Clipboard etc Best, Randall Quote Link to comment Share on other sites More sharing options...
randallc Posted November 11, 2005 Report Share Posted November 11, 2005 Hi, I looked at your Field doc file; my macro seems to work; just change the field names etc and retrieve what you want, or copy contents to clipboard, vars etc....let me know if not Best, Randall [PS There are so many fields, the info needs to go to an ini or text file for processing back, I would think] Quote Link to comment Share on other sites More sharing options...
Lon Posted November 15, 2005 Author Report Share Posted November 15, 2005 Randall, Thanks for your time with the form I sent you. As you can see there were a lot of fields on the form, but only a few fields from each form repeat in other forms. All of the collected information will comes together in a regular word document upon completion of the filled forms. Your example gets me started and works pretty well. Thank You Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.