Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Autorun a macro

I'm sure I'm missing something obvious, but is there a way to make a
macro/vba program run automatically when the workbook is opened?
In my case I have a link to data on a server that refreshes on opening the
workbook and then must be manipulated. Currently I have a button to
click, but I want to avoid user forgetfulness if possible.
Thanks
Paul

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Autorun a macro

Hi Paul
If its the same workbook each time you could try putting the following line
into the Workbook_Open event procedure of that workbook:

Application.Run "MacroName"

Hope that helps

Andy

"Paul Wisken" wrote:

I'm sure I'm missing something obvious, but is there a way to make a
macro/vba program run automatically when the workbook is opened?
In my case I have a link to data on a server that refreshes on opening the
workbook and then must be manipulated. Currently I have a button to
click, but I want to avoid user forgetfulness if possible.
Thanks
Paul


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Autorun a macro



Thanks Andy,
Sound simple, but most of that went straight over my head, so it's back
to the old VB help now to see what you're talking about.
Paul

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Autorun a macro

section "thisworkbook" in vba manager and then:

Private Sub Workbook_Open()

End Sub
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Autorun a macro

in a module ...

Sub Auto_Open

your code here

End Sub

As soon as the workbook is open the code in the Auto_Open sub will run



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autorun a macro


Good afternoon Paul Wisken

Two ways:

First call your macro Auto_Open eg:
Sub Auto_Open()

Second, the above will work but you should really use the even
procedures facility. Put the code for your macro in the ThisWorkboo
pane within the VBE, rather than the Modules pane and then change th
name to Workbook_Open().

Does that make any more sense...?

For more information about this have a look he

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

HTH

Dominic

--
dominic
-----------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...fo&userid=1893
View this thread: http://www.excelforum.com/showthread.php?threadid=43660

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autorun a macro

Thanks everyone.
It's now working perfectly

Paul

*** Sent via Developersdex http://www.developersdex.com ***
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
Autorun macro Josh Excel Discussion (Misc queries) 2 August 16th 09 02:19 PM
MACRO AUTORUN b52shut Excel Discussion (Misc queries) 1 December 15th 05 08:48 AM
Excel Macro Issue Trying to autorun Macro Upon Opening Worksheet wyndman Excel Programming 2 May 25th 04 06:59 PM
Autorun Macro RK[_3_] Excel Programming 2 February 26th 04 12:15 PM
Autorun a macro No Name Excel Programming 2 November 21st 03 09:26 PM


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