Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-23-2017, 06:51 AM
eduzs eduzs is offline Why vba code stops working after a document open command? Windows 10 Why vba code stops working after a document open command? Office 2010 32bit
Expert
Why vba code stops working after a document open command?
 
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
  #2  
Old 08-23-2017, 03:02 PM
macropod's Avatar
macropod macropod is offline Why vba code stops working after a document open command? Windows 7 64bit Why vba code stops working after a document open command? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,365
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Maybe that's because something in _AutoTexto.docm - a macro enabled document - is trying to run but requires user input before it can continue. With 'Visible:=False' you'll never see what that is...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why vba code stops working after a document open command? Drag and Drop Stops Working TucsonJack Word 7 04-26-2023 04:36 PM
Why vba code stops working after a document open command? when using find in vba several times it stops working Salah Word VBA 1 03-02-2017 03:02 AM
Outlook Stops Working TOKonline Outlook 0 09-26-2014 05:39 AM
Why vba code stops working after a document open command? Uncheck Checkbox Code not working if document protected bandrist Word VBA 2 08-14-2013 09:02 AM
VB code from one document runs on other open documents beav_35 Word VBA 0 11-10-2010 02:52 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:40 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft