AlexanderBB
Well-known Member
- Joined
- Jul 1, 2009
- Messages
- 1,953
- Office Version
- 2019
- 2016
- Platform
- Windows
Hi, I'm trying to load a text file into Word 2007 and automatically run a macro. I'm using Powertoys SendTo on my text file to "C:\Program Files\Microsoft Office\Office12\EXCEL.EXE" E:\Test\Resource.xlsm
I'm nearly there but what I find is the text file becomes a second VBA Project and Workbook Open executes before the text file has loaded. I want it to execute after its loaded.
I was given this for the Workbook Open module but it's not working as hoped.
Any help appreciated,
Thanks, ABB
I'm nearly there but what I find is the text file becomes a second VBA Project and Workbook Open executes before the text file has loaded. I want it to execute after its loaded.
I was given this for the Workbook Open module but it's not working as hoped.
Code:
Public Sub Workbook_Open_Delayed()
MsgBox ActiveSheet.Name
Stop
End Sub
Private Sub Workbook_Activate()
Static OpenHasRun As Boolean
If Not OpenHasRun Then
Workbook_Open_Delayed
OpenHasRun = True
End If
End Sub
Any help appreciated,
Thanks, ABB