Some extra notes for these main forum posts
https://www.excelfox.com/forum/showt...ll=1#post24163
https://www.excelfox.com/forum/showt...age3#post24163
https://eileenslounge.com/viewtopic....317547#p317547
https://eileenslounge.com/viewtopic....317533#p317533
This is the original coding from SamPi , which confused me a bit for a few reasons
The choice of variable names;
the use of a .xlam file; ( and
the Class module is only part of the story )
Class Module:
ThisWorkbook:Code:Option Explicit Public WithEvents App As Application Private Sub App_WorkbookOpen(ByVal Wb As Workbook) Dim s As String s = Wb.Name If s = "test.csv" Then MyMacro End Sub Sub MyMacro() MsgBox "Yes" End Sub
Code:Option Explicit Dim App As New App Private Sub Workbook_Open() Set App.App = Application End Sub




Reply With Quote
Bookmarks