Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Registry syntax to ensure that an addin is opened readonly ? keepITcool Excel Programming 3 May 30th 08 01:31 PM
code to check file size everytime an Excel file is opened Kaiser[_2_] Excel Programming 2 July 30th 06 05:46 PM
stop excel file opened as read only if already opened by another u bobm Excel Programming 3 August 5th 05 04:11 PM
Addin opened but not loaded Jac Tremblay[_3_] Excel Programming 1 November 30th 04 04:15 PM
How set file open path to filepath of file opened with Explorer ? RandyDtg1 Excel Programming 0 May 14th 04 02:05 AM


All times are GMT +1. The time now is 03:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"