Type Text in Word from Access VBA
-
Wednesday, October 28, 2009 5:17 PM
Hi
I'm a novice in using Access VBA to do things in Word and would like some code that will type into word. I have the following as a starting point and although it runs through without error, I cannot see the text in the resulting Word doc. What am I doing wrong? Thanks in advance.
Dim MyWord As Word.Application, MyDoc As Word.Document, MySelection As SelectionSet MyWord = New Word.Application
Set MyDoc = MyWord.Documents.Add
Set MySelection = Word.SelectionMyWord.Visible = True
MySelection.TypeText ("Project Status Report")
MySelection.TypeParagraphEnd Sub
- Moved by Jeff Shan Friday, October 30, 2009 1:19 AM vba question (From:Visual Basic General)
All Replies
-
Wednesday, October 28, 2009 5:19 PM
Try vba forum http://social.msdn.microsoft.com/forums/en-US/isvvba/threads/
kaymaf
If that what you want, take it. If not, ignored it and no complain- Proposed As Answer by Levi DomingosMicrosoft Community Contributor Wednesday, October 28, 2009 10:13 PM
-
Wednesday, October 28, 2009 5:25 PMthanks
-
Tuesday, November 03, 2009 6:09 AMModerator
Hello,
After the document is added, please make sure it's active document of Word:
MyDoc.Activate
OR
Use Range.Text property to input text, like:
MyDoc.Range(0.0).Text="My Input"
Thanks.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- Marked As Answer by Tim LiModerator Tuesday, November 03, 2009 6:09 AM

