View Single Post
 
Old 03-28-2016, 08:02 PM
rpb925 rpb925 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Mar 2016
Location: Sydney
Posts: 17
rpb925 is on a distinguished road
Default

Greg,

That is mind boggling. It's so concise. Thanks heaps The eyes bleeding was a good burn by the way. So the code works perfectly when I run as a normal macro in a word document but when I try and call it from my vba in access for a nearly created word document its not working so I don't believe I am calling it correctly or it isn't being referenced. I have saved the script in a module. Then I call the sub routine. The script runs but nothing happens. So I think it is the following line that might not be referencing the document correctly as I am not in the document as such it has just been created and is being filled with text using VBA. Is there any other way to reference the newly created word document.
Your reference
Code:
Set oRng = ActiveDocument.Range
In the father routine it is referenced as follows
Code:
'Create a new document
    Set wdDoc = .Documents.Add
    With wdDoc
Can I use the reference wdDoc or can I not use the reference from the father routine in the child sub routine?

Thanks.
Reply With Quote