C
Chad
Hi All
I want to send cell data from Excel to Word as text, in a specific
place in the word document, same place each month. I thought
bookmarks in Word would do the trick but they get overwritten and need
to be reset time and again. I found this post online which the author
said worked nicely using variables. I can not get it to work as I do
not know how to set Variables in Word. Does anyone know how to get
this code working? Or an alternative method if this is all wrong?
Thanks in advance.
Chad
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.Add(sWdFileName)
'Is there a way to have word open say C:\Test.doc instead of above
With doc
..Variables("Test1").Value = Range("Test1").Value
..Variables("Test2").Value = Range("Test2").Value
..Variables("Test3").Value = Range("Test3").Value
..Range.Fields.Update
End With
objWord.Visible = True
End Sub
I want to send cell data from Excel to Word as text, in a specific
place in the word document, same place each month. I thought
bookmarks in Word would do the trick but they get overwritten and need
to be reset time and again. I found this post online which the author
said worked nicely using variables. I can not get it to work as I do
not know how to set Variables in Word. Does anyone know how to get
this code working? Or an alternative method if this is all wrong?
Thanks in advance.
Chad
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.Add(sWdFileName)
'Is there a way to have word open say C:\Test.doc instead of above
With doc
..Variables("Test1").Value = Range("Test1").Value
..Variables("Test2").Value = Range("Test2").Value
..Variables("Test3").Value = Range("Test3").Value
..Range.Fields.Update
End With
objWord.Visible = True
End Sub