A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Setting up and Configuration of Excel
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Sub Autoexec () will not start the Macros running!



 
 
Thread Tools Display Modes
  #1  
Old July 22nd 12, 06:41 PM posted to microsoft.public.excel.setup
JHB
external usenet poster
 
Posts: 30
Default Sub Autoexec () will not start the Macros running!

Hi I have a spreadsheet and want to start it running as soon as it is
opend. I have dreated a macro that says the following:


Sub AutoExec ()


Sheets("Open").Select

' starter Macro
' Macro recorded 7/14/2012 by John Baker
echo = False
'Import the director name for files
Application.Run "GETDIRECTORY"
'import the list of files created NOTE only two are usedful
echo = False
Application.Run "GetFileList"
'Run the file process
echo = False
Application.Run "filesprocess"
'YES in k1 says the file does exist NO says it does not


End Sub
It works fine when you manually start it, but it will not trigger
when the spreadsheet is opened.

Is there some sort of hidden setting that controls this sort of thing,
or is there some other potential explaination. I have never had this
problem before!

Help

John Baker

Ads
  #2  
Old November 3rd 12, 11:01 AM
jack_n_bub jack_n_bub is offline
Member
 
First recorded activity by ExcelBanter: Oct 2012
Location: Bangalore
Posts: 41
Thumbs up

Quote:
Originally Posted by JHB View Post
Hi I have a spreadsheet and want to start it running as soon as it is
opend. I have dreated a macro that says the following:


Sub AutoExec ()


Sheets("Open").Select

' starter Macro
' Macro recorded 7/14/2012 by John Baker
echo = False
'Import the director name for files
Application.Run "GETDIRECTORY"
'import the list of files created NOTE only two are usedful
echo = False
Application.Run "GetFileList"
'Run the file process
echo = False
Application.Run "filesprocess"
'YES in k1 says the file does exist NO says it does not


End Sub
It works fine when you manually start it, but it will not trigger
when the spreadsheet is opened.

Is there some sort of hidden setting that controls this sort of thing,
or is there some other potential explaination. I have never had this
problem before!

Help

John Baker
Hi,

Try inserting this code in the Thisworkbook's Workbook_Open event. This runs the macro everytime the workbook is opened.

To do this.

Copy your code (not the Sub and End Sub statements).

Double Click on the Thisworkbook object
Select Workbook from the object drop down
Select Open from the event drop down
paste your code in this block

Hope this helps.

Thanks,
Prashant
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i start Macros using IF statements? xXx Katie xXx Excel Discussion (Misc queries) 2 August 22nd 05 03:13 PM
Acrobat Distiller: start if not running Filips Benoit Excel Programming 2 September 3rd 04 03:13 PM
Macro Running at Spreadsheet Start MWhitehead Excel Programming 3 June 10th 04 12:35 PM
How to have macros enabled at start Bill D.[_2_] Excel Programming 3 April 16th 04 12:16 AM
AutoExec - Enable Macros Bob Barnes[_3_] Excel Programming 3 January 18th 04 07:56 PM


All times are GMT +1. The time now is 10:29 AM.


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