View Single Post
 
Old 08-23-2017, 06:51 AM
eduzs eduzs is offline Windows 10 Office 2010 32bit
Expert
 
Join Date: May 2017
Posts: 266
eduzs is on a distinguished road
Default Why vba code stops working after a document open command?

I have this simple code:

Code:
Option Explicit

Global GlobDoc As Document

Sub Call_Autotexto()

Dim AppDoc2 As Document

Set GlobDoc = ActiveDocument

Set AppDoc2 = Documents.Open("E:\X\_AutoTexto.docm", Visible:=False)
Set AppDoc2 = Nothing

MsgBox "oi"

GlobDoc.Activate

End Sub
The "AutoTexto" have some complex vba code that runs and closes itself, but there's no "Oi" msgbox.

The code after documents open seems not working.

Any ideas?

Thanks.
__________________
Backup your original file before doing any modification.
Reply With Quote