ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Setting up and Configuration of Excel (https://www.excelbanter.com/setting-up-configuration-excel/)
-   -   Sub Autoexec () will not start the Macros running! (https://www.excelbanter.com/setting-up-configuration-excel/446642-sub-autoexec-will-not-start-macros-running.html)

JHB

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


jack_n_bub

Quote:

Originally Posted by JHB (Post 1603887)
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


All times are GMT +1. The time now is 01:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com