Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Workbook_open Event

Hi All,

How I can run macro when only CSV format file opened.

Thanks

Hassan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Workbook_open Event


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


--
__________________________________
HTH

Bob

"Hassan" wrote in message
...
Hi All,

How I can run macro when only CSV format file opened.

Thanks

Hassan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Workbook_open Event

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

"Bob Phillips" wrote:


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


--
__________________________________
HTH

Bob

"Hassan" wrote in message
...
Hi All,

How I can run macro when only CSV format file opened.

Thanks

Hassan




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Workbook_open Event

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)

"Hassan" wrote in message
...
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

"Bob Phillips" wrote:


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


--
__________________________________
HTH

Bob

"Hassan" wrote in message
...
Hi All,

How I can run macro when only CSV format file opened.

Thanks

Hassan






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
WORKBOOK_OPEN event DKS Excel Programming 6 September 22nd 06 10:40 PM
Workbook_Open() Event Bill Martin Excel Discussion (Misc queries) 9 January 13th 06 08:24 PM
Workbook_Open Event Squid[_2_] Excel Programming 7 February 8th 04 06:49 PM
WorkBook_Open Event Squid[_3_] Excel Programming 1 February 8th 04 02:45 AM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM


All times are GMT +1. The time now is 08:48 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"