Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Run code when ANY file opens

I want to run some VBA code on a PC whenever ANY workbook is opened in excel.
It can not only be when excel opens, it need to be even if a new file is
oened once excel is already running. Any suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Run code when ANY file opens


In a module, create an Auto_Open macro, like:

Public Sub Auto_Open()
'do the hokie pokie
End Sub

Save your file with the .xla extension, to make it an Add-in.
Pick Extra/Add-ins and check your own file. After that, it'll always run
when Excel is opened.




"Shimmess" schreef in bericht
...
I want to run some VBA code on a PC whenever ANY workbook is opened in
excel.
It can not only be when excel opens, it need to be even if a new file is
oened once excel is already running. Any suggestions?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Run code when ANY file opens

http://www.cpearson.com/excel/appevent.htm

so you would need to start application level events by using an addin in
Excel that is loaded when excel starts.

--
Regards,
Tom Ogilvy




"Shimmess" wrote:

I want to run some VBA code on a PC whenever ANY workbook is opened in excel.
It can not only be when excel opens, it need to be even if a new file is
oened once excel is already running. Any suggestions?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Run code when ANY file opens

Will this work then on a file that is opened and excel is already running?

"moon" wrote:


In a module, create an Auto_Open macro, like:

Public Sub Auto_Open()
'do the hokie pokie
End Sub

Save your file with the .xla extension, to make it an Add-in.
Pick Extra/Add-ins and check your own file. After that, it'll always run
when Excel is opened.




"Shimmess" schreef in bericht
...
I want to run some VBA code on a PC whenever ANY workbook is opened in
excel.
It can not only be when excel opens, it need to be even if a new file is
oened once excel is already running. Any suggestions?




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Run code when ANY file opens

It only runs when the addin gets loaded - it has nothing to do with any other
file being opened. So the short answer is no.

--
Regards,
Tom Ogilvy




"Shimmess" wrote:

Will this work then on a file that is opened and excel is already running?

"moon" wrote:


In a module, create an Auto_Open macro, like:

Public Sub Auto_Open()
'do the hokie pokie
End Sub

Save your file with the .xla extension, to make it an Add-in.
Pick Extra/Add-ins and check your own file. After that, it'll always run
when Excel is opened.




"Shimmess" schreef in bericht
...
I want to run some VBA code on a PC whenever ANY workbook is opened in
excel.
It can not only be when excel opens, it need to be even if a new file is
oened once excel is already running. Any suggestions?






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Run code when ANY file opens

thuoght so. Your suggestion works fine. It seems that the application that
is launching the ecel files I want to edit is able to bypass the code I put
in. Is it possible for apps to code in to bypass the Open function? If they
did, any other options to force my code anyways or am I out of luck?

"Tom Ogilvy" wrote:

It only runs when the addin gets loaded - it has nothing to do with any other
file being opened. So the short answer is no.

--
Regards,
Tom Ogilvy




"Shimmess" wrote:

Will this work then on a file that is opened and excel is already running?

"moon" wrote:


In a module, create an Auto_Open macro, like:

Public Sub Auto_Open()
'do the hokie pokie
End Sub

Save your file with the .xla extension, to make it an Add-in.
Pick Extra/Add-ins and check your own file. After that, it'll always run
when Excel is opened.




"Shimmess" schreef in bericht
...
I want to run some VBA code on a PC whenever ANY workbook is opened in
excel.
It can not only be when excel opens, it need to be even if a new file is
oened once excel is already running. Any suggestions?



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Run code when ANY file opens

I suspect if excel is being launched by some other application, then your
addin isn't being loaded. There wouldn't be a way around this that I could
think of. When excel is opened via automation, it doesn't load addins or
files in the xlstart directory.

Just a guess that your code is correct and that is what is happening.

--
Regards,
Tom Ogilvy

"Shimmess" wrote in message
...
thuoght so. Your suggestion works fine. It seems that the application
that
is launching the ecel files I want to edit is able to bypass the code I
put
in. Is it possible for apps to code in to bypass the Open function? If
they
did, any other options to force my code anyways or am I out of luck?

"Tom Ogilvy" wrote:

It only runs when the addin gets loaded - it has nothing to do with any
other
file being opened. So the short answer is no.

--
Regards,
Tom Ogilvy




"Shimmess" wrote:

Will this work then on a file that is opened and excel is already
running?

"moon" wrote:


In a module, create an Auto_Open macro, like:

Public Sub Auto_Open()
'do the hokie pokie
End Sub

Save your file with the .xla extension, to make it an Add-in.
Pick Extra/Add-ins and check your own file. After that, it'll always
run
when Excel is opened.




"Shimmess" schreef in bericht
...
I want to run some VBA code on a PC whenever ANY workbook is opened
in
excel.
It can not only be when excel opens, it need to be even if a new
file is
oened once excel is already running. Any suggestions?





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
Excel file opens and opens and opens Wanna Learn Excel Discussion (Misc queries) 1 June 9th 09 11:03 PM
Opening file in Excel 2003 opens multipule instances of same file Ed_B Excel Discussion (Misc queries) 1 June 21st 07 07:10 PM
opening an excel file opens a duplicate file of the same file skm Excel Discussion (Misc queries) 1 December 7th 05 05:52 PM
clicking .XLS file opens Excel 2003 but doesn't find the file Arrow Computer Excel Discussion (Misc queries) 2 August 10th 05 03:51 AM
Double Click .xls file in Explorer opens Excel but no file Kaypee Setting up and Configuration of Excel 3 March 3rd 05 03:45 PM


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