V
Vincent Verheul
Hello,
I have a question about insering text: I want to create a new Word document
using VBA and insert text into that document uring VBA. Since the text is
quite large, it may take some time. During that time, users may want to read
their email (using Word) or edit text in another Word document.
Currently that is not possible with my code: the text inserted by VBA is
always inserted at the current active cursor: resulting in the text being
inserted into the wrong document!
Below an example of the code. I am using the Documents's ActiveWindow
Selection (cursor):
Set WordApp = GetObject(, "Word.Application") ' Assumes Word is running
Set Doc = WordApp.Documents.Add(Template:=Template, NewTemplate:=False,
_
DocumentType:=wdNewBlankDocument)
With Doc.ActiveWindow.Selection
.TypeText "This text line."
.TypeParagraph
End With
Doc.close
What can I do to make sure that text is inserted only into the specific
document that I create through VBA?
Thanks in advance!
Vincent
I have a question about insering text: I want to create a new Word document
using VBA and insert text into that document uring VBA. Since the text is
quite large, it may take some time. During that time, users may want to read
their email (using Word) or edit text in another Word document.
Currently that is not possible with my code: the text inserted by VBA is
always inserted at the current active cursor: resulting in the text being
inserted into the wrong document!
Below an example of the code. I am using the Documents's ActiveWindow
Selection (cursor):
Set WordApp = GetObject(, "Word.Application") ' Assumes Word is running
Set Doc = WordApp.Documents.Add(Template:=Template, NewTemplate:=False,
_
DocumentType:=wdNewBlankDocument)
With Doc.ActiveWindow.Selection
.TypeText "This text line."
.TypeParagraph
End With
Doc.close
What can I do to make sure that text is inserted only into the specific
document that I create through VBA?
Thanks in advance!
Vincent