Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Run Macro Automatically When Excel 2003 Opens

I usually use Auto_Open -- just because it's easier to explain how to implement
it.

So as long as you have the code in a General module and the users are allowing
macros to run, it should execute.

Now a question...

How is this workbook being opened? Is it a manual File|Open (ctrl-o) or
doubleclicking on the filename in explorer?

Or is it opened by procedure in another workbook? And if that's the case, if
you're using a shortcut key to run that procedure, then remove the shift key in
that shortcut key combination.

And I've never personally seen a problem with the code you posted, but others
have.

One solution is to wait a second and then call your procedu

Option Explicit
Sub Auto_Open()
Application.OnTime earliesttime:=Now + timeserial(0,0,1), _
procedu=RefreshAllPivotTables
End Sub

The theory is that it gives excel a chance to regroup and catch up to what it's
supposed to be doing.

CBender wrote:

!!! HELP PLEASE !!!!!

I have a password protected MS Excel 2003 spreadsheet with several Pivot
Tables and numerous tabs collecting and displaying data based on these Pivot
Tables.

Specific individuals can open this MS Excel 2003 file for updates using a
password and others simply open the file in "Read Only" mode.

I have seven (7) Pivot Tables I need to have refreshed each time the MS
Excel 2003 file opens. I created a macro called "RefreshAllPivotTables" in
This Workbook. The macro goes to each of the Pivot Tables and refreshes the
linked data when you use "ctrl+u".

I need to ensure that each of the Pivot Tables always display the latest
information available. However, our directors and managers find it too
"inconvenient" to run the macro to refresh the data themselves.

Thus I have been trying to get this macro to run automatically when the MS
Excel 2003 file opens.

I selected the third tab called "R3 Total" (there are a total of fifteen
(15) tabs in this MS Excel 2003 file) and selected "View Coding". Using the
VB Editor, I entered the following code:

Option Explicit
Sub Auto_Open()
Call RefreshAllPivotTables
End Sub

It doesn't seem to matter if I open the MS Excel 2003 file in "Read Only"
mode or use the password to open the file, my stored macro fails to execute
automatically. Does it matter which tab is used or opened first? I need my
"RefreshAllPivotTables" macro to run regardless of which of the fifteen (15)
tabs are opened first.

A co-worker mentioned that MS Excel 2003 no longer supports auto-run macro
functions when a file opens. Is this true or am I simply doing something
wrong?

Any HELP would be appreciated.

Thanks,
--
Chip


--

Dave Peterson
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 opens two windows (2007 & 2003 format): I want only 2003. Rob Excel Discussion (Misc queries) 0 March 6th 10 07:46 PM
Auto adding a macro when Excel 2003 opens gigabyteconsulting Excel Discussion (Misc queries) 4 July 6th 09 08:57 PM
writing a macro that automatically opens another file J.Mart[_2_] Excel Discussion (Misc queries) 3 August 12th 08 10:44 PM
Excel automatically opens files FileCrazy Excel Discussion (Misc queries) 7 December 12th 06 04:58 PM
Excel file automatically opens Lost4Now Excel Discussion (Misc queries) 6 December 4th 05 09:35 PM


All times are GMT +1. The time now is 01:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"