Startup Notepad from Excel???
Hmmm, I will see if I can get your procedure to work for me.
However, your procedure assumes that the Word file already
pre-exists and it must contain these DocVariables. For my purposes
I will need to create a "new" Word file at run time and then transfer
data onto the blank Word file . Will your procedure work for my
scenario??
"ryguy7272" wrote in message
...
I've done this many times! In Word (2003), click Insert Field Field
Name
= DocVariables... name your variable. Enter a few more...
Hit Alt+F9 to see your DocVariables.
In Excel, Insert Name Define... name your range... NamedRange in Excel
must equal DocVariable in Word.
In Excel, create a Modeul and copy paste this code into the Module:
Sub PushToWord()
Dim objWord As New Word.Application
Dim doc As Word.Document
Dim bkmk As Word.Bookmark
sWdFileName = Application.GetOpenFilename(, , , , False)
Set doc = objWord.Documents.Open(sWdFileName)
'On Error Resume Next
objWord.ActiveDocument.variables("BrokerFirstName" ).Value =
Range("BrokerFirstName").Value
objWord.ActiveDocument.variables("BrokerLastName") .Value =
Range("BrokerLastName").Value
objWord.ActiveDocument.Fields.Update
'On Error Resume Next
objWord.Visible = True
End Sub
|