#1
|
|||
|
|||
How to Open a Word Document from ACCESS VBA
I need help opening a file from a UserForm which has a command button to open a word document.
I am using Access2003 and Word 2010. Some machines are running XP and others WIN7. I would like the Document to open, have it showing with either macros already enabled or the prompt to enable them. I was trying the following, but the WIN7 would open the document as read-only with no apparent way to enable the macros. The word file was previously tagged as a trusted site in WIN7. |
#2
|
||||
|
||||
It works for me. Do note, though, that if your Word document contains a Document_Open macro, for example, and that requires any user interaction, its interface will only be seen once you switch windows to the Word application. For example:
Code:
Dim wdObj As Object, wdDoc As Object Set wdObj = CreateObject("Word.Application") wdObj.Visible = True wdObj.Activate Set wdDoc = wdObj.Documents.Open(Webtarget)
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
OK...
When my document opens, it is visible but still LOCKED. The VBA code isn't enabled when the document is opened (the VBA code within the document unprotects the document and performs other functions). Any further assistance would be appreciated. Also, the document opens as READ-ONLY. |
#4
|
||||
|
||||
In my testing, a Document_Open or AutoOpen macro in the opened document will run and, if coded to do so, unprotect the document for editing.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
importing Access data to a Word document | WayneCusack | Word VBA | 2 | 12-24-2012 12:26 AM |
Cant open word document | bootable | Word | 1 | 01-21-2012 12:46 PM |
word cannot open the document | esto | Word | 1 | 10-03-2009 03:16 AM |
Protecting Word Document by restricting access permissions! | user | Word | 0 | 11-20-2008 01:21 PM |
Can I fill in Word document from Access table and/or query? | slim_jim_56 | Word Tables | 0 | 10-03-2007 01:59 PM |