how to run macro on opening of file

H

Hassan

Hi All,

I want to run macro "Wathba" on every CSV format file on opening.

Plz help

Thanks & Regards

Hassan
 
T

Tausif

Hi Hassan,

Since you want it to be open on every csv file format, Why dont save the
macro in personal.xls & run it when you need to open a csv file. ?
(Tools->Macro->Macros)

Cheers,
 
B

Bob Phillips

Public WithEvents App As Application

Private Sub App_WorkbookOpen(ByVal Wb As Workbook)

If Wb.FileFormat = xlCSV Then Call mymacro
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
 

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

Workbook_open Event 3
P 1
Run Macro If Cell have "x" value 0
Apply macro 2
how to run a recorded macro in many files at a same time 1
Divided by zero 2
Date Format 2
Find & Replace Macro 3

Top