M
Mr B
I have been attempting to add some text to a Word document via VBA.
Here is a snipit of my code:
Dim wordApp As Object
Dim WordDoc As Object
strNewDocPathAndName = strNewDocPath & "\" & strNewName & ".doc"
wordApp.ActiveDocument.SaveAs FileName:=strNewDocPathAndName
Set WordDoc = wordApp.ActiveDocument
WordDoc.Selection.TypeText Text:="This is the spot."
I have had a couple of times that the code above works to write the text to
the document. However, most of the time it just appears to skip the code
altogether.
I have tried several versions of the code with no success.
I'm sure there is something that I am just missing.
Any evaluation of my code would be appreciated.
Here is a snipit of my code:
Dim wordApp As Object
Dim WordDoc As Object
strNewDocPathAndName = strNewDocPath & "\" & strNewName & ".doc"
wordApp.ActiveDocument.SaveAs FileName:=strNewDocPathAndName
Set WordDoc = wordApp.ActiveDocument
WordDoc.Selection.TypeText Text:="This is the spot."
I have had a couple of times that the code above works to write the text to
the document. However, most of the time it just appears to skip the code
altogether.
I have tried several versions of the code with no success.
I'm sure there is something that I am just missing.
Any evaluation of my code would be appreciated.