#1
|
|||
|
|||
VB code from one document runs on other open documents
When I open two documents one with VB code and the other with none the macros in the first document seem to apply to both documents. In fact if I have multiple documents with VB code open the code in each document applies to every other document that is open. Has anyone else seen this bug before and know any solutions or workarounds? This is the code that I used to test: Dim WithEvents wdapp As Application Private Sub Document_Open() Set wdapp = Application End Sub Private Sub Document_New() Set wdapp = Application End Sub Private Sub wdapp_DocumentBeforeSave(ByVal Doc As Document, SaveAsUI As Boolean, Cancel As Boolean) MsgBox ("This document has macros") End Sub Private Sub Document_Close() Set wdapp = Nothing End Sub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how can I add a peace of code to MS document | amlife | Word VBA | 0 | 03-03-2010 03:35 PM |
Can't open documents directly from a shared drive | MikeJedi | Word | 0 | 12-08-2009 12:04 PM |
Excel Files Will Not Open From Documents Normally | tremaine | Excel | 1 | 06-17-2009 08:05 AM |
Some Word documents open slower than others | Mosaic | Word | 1 | 09-21-2007 02:53 PM |
Documents Take 5 Minutes To Open | Farrar | Word | 1 | 07-23-2007 02:54 PM |