Jump to content
Macro Express Forums

Word 2003 & Macro Express


Lon

Recommended Posts

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.

Link to comment
Share on other sites

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.)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>r

Wait For Window Title: "Text Form Field Options"

Text Type: <ALT>e<CONTROL>c

Variable Set String %T3% from Clipboard

etc

 

Best, Randall

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...