Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Addin - Look for a File when it is opened
Hi All,
I am not sure how to word this. I want to make an addin that monitors which files are opened. When a particular file is open, then run a macro. I don't want the marco in the file in question, because the people I send the file too, see the message about a macro, and refuse to open it, or it gets block. I know I could call the macro from a button, but I thought having the marco start when the file is opened would be easier. Thanks Chad |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Addin - Look for a File when it is opened
There are application events that you can tie into.
Start a new workbook and put this in the ThisWorkbook Module: Option Explicit Public WithEvents xlApp As Excel.Application Private Sub Workbook_Open() Set xlApp = Application End Sub Private Sub Workbook_Close() Set xlApp = Nothing End Sub Private Sub xlApp_WorkbookOpen(ByVal Wb As Workbook) If LCase(Wb.Name) = LCase("hi there.xls") Then MsgBox "Found it!" End If 'or check using the path, too???? If LCase(Wb.FullName) = LCase("C:\my documents\excel\hi there.xls") Then MsgBox "Right folder, too" End If End Sub Then save this as an addin and either install it (tools|addins) or put it in your XLStart folder. (You'll have to explain to the users how to install it.) Chad Cameron wrote: Hi All, I am not sure how to word this. I want to make an addin that monitors which files are opened. When a particular file is open, then run a macro. I don't want the marco in the file in question, because the people I send the file too, see the message about a macro, and refuse to open it, or it gets block. I know I could call the macro from a button, but I thought having the marco start when the file is opened would be easier. Thanks Chad -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Registry syntax to ensure that an addin is opened readonly ? | Excel Programming | |||
code to check file size everytime an Excel file is opened | Excel Programming | |||
stop excel file opened as read only if already opened by another u | Excel Programming | |||
Addin opened but not loaded | Excel Programming | |||
How set file open path to filepath of file opened with Explorer ? | Excel Programming |