Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 84
Default Macro to run on file open

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Macro to run on file open


Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Macro to run on file open

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Macro to run on file open

Yup, I forgot to mention it...........thanks for the catch Don.

Vaya con Dios,
Chuck, CABGx3



"Don Guillett" wrote:

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 84
Default Macro to run on file open

Thanks

"CLR" wrote:

Yup, I forgot to mention it...........thanks for the catch Don.

Vaya con Dios,
Chuck, CABGx3



"Don Guillett" wrote:

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 84
Default Macro to run on file open

Hi

Thanks for that, I've put this into a module, when I run it, all works fine,
but when I open my spreadsheet, nothing happens, is there something else I
need to do?

"CLR" wrote:

Yup, I forgot to mention it...........thanks for the catch Don.

Vaya con Dios,
Chuck, CABGx3



"Don Guillett" wrote:

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks




  #7   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Macro to run on file open

That's what Don was saying.........are you sure you put it in the
"ThisWorkbook" module?
Right-click on a Tab, ViewCode then double-click on the "ThisWorkbook"
module and paste in the right hand window.

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

Hi

Thanks for that, I've put this into a module, when I run it, all works fine,
but when I open my spreadsheet, nothing happens, is there something else I
need to do?

"CLR" wrote:

Yup, I forgot to mention it...........thanks for the catch Don.

Vaya con Dios,
Chuck, CABGx3



"Don Guillett" wrote:

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks



  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 84
Default Macro to run on file open

I thought that's what i did, not at the right computer right now, but will
double check, thanks.

"CLR" wrote:

That's what Don was saying.........are you sure you put it in the
"ThisWorkbook" module?
Right-click on a Tab, ViewCode then double-click on the "ThisWorkbook"
module and paste in the right hand window.

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

Hi

Thanks for that, I've put this into a module, when I run it, all works fine,
but when I open my spreadsheet, nothing happens, is there something else I
need to do?

"CLR" wrote:

Yup, I forgot to mention it...........thanks for the catch Don.

Vaya con Dios,
Chuck, CABGx3



"Don Guillett" wrote:

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks



  #9   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Macro to run on file open

Ok, get back to us when you can check it out..........it's a little tricky
until you've done it a few times....

Have a good day,

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

I thought that's what i did, not at the right computer right now, but will
double check, thanks.

"CLR" wrote:

That's what Don was saying.........are you sure you put it in the
"ThisWorkbook" module?
Right-click on a Tab, ViewCode then double-click on the "ThisWorkbook"
module and paste in the right hand window.

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

Hi

Thanks for that, I've put this into a module, when I run it, all works fine,
but when I open my spreadsheet, nothing happens, is there something else I
need to do?

"CLR" wrote:

Yup, I forgot to mention it...........thanks for the catch Don.

Vaya con Dios,
Chuck, CABGx3



"Don Guillett" wrote:

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks



  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 84
Default Macro to run on file open

That worked fine, thanks. I'd put it in the right place but when I called my
macro I forgot to put Sheet1 before the name!

"CLR" wrote:

Ok, get back to us when you can check it out..........it's a little tricky
until you've done it a few times....

Have a good day,

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

I thought that's what i did, not at the right computer right now, but will
double check, thanks.

"CLR" wrote:

That's what Don was saying.........are you sure you put it in the
"ThisWorkbook" module?
Right-click on a Tab, ViewCode then double-click on the "ThisWorkbook"
module and paste in the right hand window.

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

Hi

Thanks for that, I've put this into a module, when I run it, all works fine,
but when I open my spreadsheet, nothing happens, is there something else I
need to do?

"CLR" wrote:

Yup, I forgot to mention it...........thanks for the catch Don.

Vaya con Dios,
Chuck, CABGx3



"Don Guillett" wrote:

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks





  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 84
Default Macro to run on file open

Spoke to soon, the macro that starts running opens another workbook, this now
tries to run the job again when it opens, do you know how I ensure that this
'on open' only works for the current workbook?

"CLR" wrote:

Ok, get back to us when you can check it out..........it's a little tricky
until you've done it a few times....

Have a good day,

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

I thought that's what i did, not at the right computer right now, but will
double check, thanks.

"CLR" wrote:

That's what Don was saying.........are you sure you put it in the
"ThisWorkbook" module?
Right-click on a Tab, ViewCode then double-click on the "ThisWorkbook"
module and paste in the right hand window.

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

Hi

Thanks for that, I've put this into a module, when I run it, all works fine,
but when I open my spreadsheet, nothing happens, is there something else I
need to do?

"CLR" wrote:

Yup, I forgot to mention it...........thanks for the catch Don.

Vaya con Dios,
Chuck, CABGx3



"Don Guillett" wrote:

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks



  #12   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 84
Default Macro to run on file open

Ignore my last post, I put it into a module and it ran fine, thanks so much
for your help, much appreciated.

"Marie Bayes" wrote:

Spoke to soon, the macro that starts running opens another workbook, this now
tries to run the job again when it opens, do you know how I ensure that this
'on open' only works for the current workbook?

"CLR" wrote:

Ok, get back to us when you can check it out..........it's a little tricky
until you've done it a few times....

Have a good day,

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

I thought that's what i did, not at the right computer right now, but will
double check, thanks.

"CLR" wrote:

That's what Don was saying.........are you sure you put it in the
"ThisWorkbook" module?
Right-click on a Tab, ViewCode then double-click on the "ThisWorkbook"
module and paste in the right hand window.

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

Hi

Thanks for that, I've put this into a module, when I run it, all works fine,
but when I open my spreadsheet, nothing happens, is there something else I
need to do?

"CLR" wrote:

Yup, I forgot to mention it...........thanks for the catch Don.

Vaya con Dios,
Chuck, CABGx3



"Don Guillett" wrote:

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks



  #13   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Macro to run on file open

"Hang up and I'll call you back"...<g..........I was just in the middle of a
post back to you.......ok good now that you've got it sorted.......have a
good one, and thanks for the feedback........

Vaya con Dios,
Chuck, CABGx3




"Marie Bayes" wrote:

Ignore my last post, I put it into a module and it ran fine, thanks so much
for your help, much appreciated.

"Marie Bayes" wrote:

Spoke to soon, the macro that starts running opens another workbook, this now
tries to run the job again when it opens, do you know how I ensure that this
'on open' only works for the current workbook?

"CLR" wrote:

Ok, get back to us when you can check it out..........it's a little tricky
until you've done it a few times....

Have a good day,

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

I thought that's what i did, not at the right computer right now, but will
double check, thanks.

"CLR" wrote:

That's what Don was saying.........are you sure you put it in the
"ThisWorkbook" module?
Right-click on a Tab, ViewCode then double-click on the "ThisWorkbook"
module and paste in the right hand window.

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

Hi

Thanks for that, I've put this into a module, when I run it, all works fine,
but when I open my spreadsheet, nothing happens, is there something else I
need to do?

"CLR" wrote:

Yup, I forgot to mention it...........thanks for the catch Don.

Vaya con Dios,
Chuck, CABGx3



"Don Guillett" wrote:

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks



  #14   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Macro to run on file open

Chuck

Right-clicking on a sheet tab and "view code" only gives you Worksheet module.

Best to right-click on the Excel logo left of "File" on menu and "View Code".

This opens the Thisworkbook module.


Gord

On Thu, 11 Jan 2007 04:26:00 -0800, CLR wrote:

That's what Don was saying.........are you sure you put it in the
"ThisWorkbook" module?
Right-click on a Tab, ViewCode then double-click on the "ThisWorkbook"
module and paste in the right hand window.

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

Hi

Thanks for that, I've put this into a module, when I run it, all works fine,
but when I open my spreadsheet, nothing happens, is there something else I
need to do?

"CLR" wrote:

Yup, I forgot to mention it...........thanks for the catch Don.

Vaya con Dios,
Chuck, CABGx3



"Don Guillett" wrote:

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks




  #15   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Macro to run on file open

Thanks for the clarification Gord.........."habit gets me nto these things",
once I do something one way and it works, I just keep on, even if it's not
the most efficient <g

Vaya con Dios,
Chuck, CABGx3



"Gord Dibben" wrote:

Chuck

Right-clicking on a sheet tab and "view code" only gives you Worksheet module.

Best to right-click on the Excel logo left of "File" on menu and "View Code".

This opens the Thisworkbook module.


Gord

On Thu, 11 Jan 2007 04:26:00 -0800, CLR wrote:

That's what Don was saying.........are you sure you put it in the
"ThisWorkbook" module?
Right-click on a Tab, ViewCode then double-click on the "ThisWorkbook"
module and paste in the right hand window.

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

Hi

Thanks for that, I've put this into a module, when I run it, all works fine,
but when I open my spreadsheet, nothing happens, is there something else I
need to do?

"CLR" wrote:

Yup, I forgot to mention it...........thanks for the catch Don.

Vaya con Dios,
Chuck, CABGx3



"Don Guillett" wrote:

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks







  #16   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Macro to run on file open

I have looked throught this thread for an issue that I have come across. It
doe snot resolve it, but this looks like the right area.

I have a set of macros that I want to fire off in a single workbook. This
works perfectly. However ...

I am adding a menu item that allows me to run one particular macro when an
editing process is completed. This menu item appears in all workbooks after
that. I want the macro to cleanup after the end user closes the workbook.

I have a deletemenu sub that will do this, but I am struggling on how to get
it to fire off.

This group is awesome! I have had very good responses to date!

Regards,
David Langschied
"Gord Dibben" wrote:

Chuck

Right-clicking on a sheet tab and "view code" only gives you Worksheet module.

Best to right-click on the Excel logo left of "File" on menu and "View Code".

This opens the Thisworkbook module.


Gord

On Thu, 11 Jan 2007 04:26:00 -0800, CLR wrote:

That's what Don was saying.........are you sure you put it in the
"ThisWorkbook" module?
Right-click on a Tab, ViewCode then double-click on the "ThisWorkbook"
module and paste in the right hand window.

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

Hi

Thanks for that, I've put this into a module, when I run it, all works fine,
but when I open my spreadsheet, nothing happens, is there something else I
need to do?

"CLR" wrote:

Yup, I forgot to mention it...........thanks for the catch Don.

Vaya con Dios,
Chuck, CABGx3



"Don Guillett" wrote:

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks





  #17   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Macro to run on file open

Maybe you could use the workbook_beforeclose event (in the ThisWorkbook module)
or you could use the Auto_Close procedure in a General module.

David Langschied wrote:

I have looked throught this thread for an issue that I have come across. It
doe snot resolve it, but this looks like the right area.

I have a set of macros that I want to fire off in a single workbook. This
works perfectly. However ...

I am adding a menu item that allows me to run one particular macro when an
editing process is completed. This menu item appears in all workbooks after
that. I want the macro to cleanup after the end user closes the workbook.

I have a deletemenu sub that will do this, but I am struggling on how to get
it to fire off.

This group is awesome! I have had very good responses to date!

Regards,
David Langschied
"Gord Dibben" wrote:

Chuck

Right-clicking on a sheet tab and "view code" only gives you Worksheet module.

Best to right-click on the Excel logo left of "File" on menu and "View Code".

This opens the Thisworkbook module.


Gord

On Thu, 11 Jan 2007 04:26:00 -0800, CLR wrote:

That's what Don was saying.........are you sure you put it in the
"ThisWorkbook" module?
Right-click on a Tab, ViewCode then double-click on the "ThisWorkbook"
module and paste in the right hand window.

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

Hi

Thanks for that, I've put this into a module, when I run it, all works fine,
but when I open my spreadsheet, nothing happens, is there something else I
need to do?

"CLR" wrote:

Yup, I forgot to mention it...........thanks for the catch Don.

Vaya con Dios,
Chuck, CABGx3



"Don Guillett" wrote:

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks






--

Dave Peterson
  #18   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Macro to run on file open

Generally you create the menu item in Workbook_Open event then delete the
menu item in Workbook_BeforeClose event

Private Sub Workbook_Open()
'add the menu item
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'delete the menu item
End Sub

If more than one workbook could be open with this workbook and you wanted
the menu only for the one workbook when it is active, you would also have to
allow for switching books without closing.

Private Sub Workbook_Deactivate()
hide or delete menu item
End Sub

Private Sub Workbook_Activate()
show or re-create menu item
End Sub

See more in VBA help on

Adding and Managing Menu Bars and Menu Items(Office)


Gord


On Wed, 5 Nov 2008 08:32:01 -0800, David Langschied
wrote:

I have looked throught this thread for an issue that I have come across. It
doe snot resolve it, but this looks like the right area.

I have a set of macros that I want to fire off in a single workbook. This
works perfectly. However ...

I am adding a menu item that allows me to run one particular macro when an
editing process is completed. This menu item appears in all workbooks after
that. I want the macro to cleanup after the end user closes the workbook.

I have a deletemenu sub that will do this, but I am struggling on how to get
it to fire off.

This group is awesome! I have had very good responses to date!

Regards,
David Langschied
"Gord Dibben" wrote:

Chuck

Right-clicking on a sheet tab and "view code" only gives you Worksheet module.

Best to right-click on the Excel logo left of "File" on menu and "View Code".

This opens the Thisworkbook module.


Gord

On Thu, 11 Jan 2007 04:26:00 -0800, CLR wrote:

That's what Don was saying.........are you sure you put it in the
"ThisWorkbook" module?
Right-click on a Tab, ViewCode then double-click on the "ThisWorkbook"
module and paste in the right hand window.

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

Hi

Thanks for that, I've put this into a module, when I run it, all works fine,
but when I open my spreadsheet, nothing happens, is there something else I
need to do?

"CLR" wrote:

Yup, I forgot to mention it...........thanks for the catch Don.

Vaya con Dios,
Chuck, CABGx3



"Don Guillett" wrote:

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks






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
Open a group of files in speadsheed on the same book jose_luis_fdez_diaz Excel Discussion (Misc queries) 3 October 9th 06 04:28 PM
Macro syntax to open file in current explorer folder [email protected] Excel Discussion (Misc queries) 4 January 11th 06 12:07 PM
How to stop file open macro prompt after deleting all macros? twor57 Excel Worksheet Functions 2 November 29th 05 05:00 PM
cannot open excel file, please help!!! sunlite Excel Discussion (Misc queries) 0 September 5th 05 05:29 PM
Macro to open specific File tamato43 Excel Discussion (Misc queries) 4 May 18th 05 09:42 PM


All times are GMT +1. The time now is 06:51 AM.

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"