Workbook_open Event

B

Bob Phillips

Public WithEvents App As Application

Private Sub App_WorkbookOpen(ByVal Wb As Workbook)

If Wb.FileFormat = xlCSV Then

Call myMacro
End If
End Sub

Private Sub Workbook_Open()
Set App = Application
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code
 
H

Hassan

Dear Bob,

Thnx for reply, I tried but its not working, my macro name is Module2. when
i saved the procedure which given by you, then new window open asking for
macro, when i select from the Module2 from list but next time its not running
macro automatically.

Please help me
 
B

Bob Phillips

I have no idea what you mean. Why is you macro called Module2, that sounds
like a module name? Why do you have to pick anything, you should use the
name that you presumably know already.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

how to run macro on opening of file 3
Unable to change ActiveSheet within Workbook_Open 2
Date Format 2
Apply macro 2
Private Sub Workbook_Open() 1
work book open _ event 1
Output 0 to 100 7
Date type 2

Top