How to use AutoExec macro


"Excel VBA Help"

 


Play Friv Now - Play Friv Games
Go Back   The Code Cage Forums > Microsoft Topics > Microsoft Word Forum
Our Info Pages:-
The Code Cage - Microsoft Office help

Notices

Microsoft Word Forum Members, post questions in this forum if they are related to using Microsoft Word, this includes Document Properties, VBA Programming & Functionality etc.

New Reply
Thread Tools Rate Thread Display Modes
  #1  
Unread 24th November 2014, 18:27
xuhathdo's Avatar
xuhathdo xuhathdo is offline
Junior Member
MS Office Version: MS Office 2003
MS Office Skill Level: New to Access
 
Join Date: Apr 2014
Location: An Giang, Vietnam
Age: 32
Posts: 5
Posts Per Day: 0.00
My Top Tip Count: 0
Thanks to others: 0
Thanked 0 Times in 0 Posts
Reputation: 10 (3) xuhathdo is on a distinguished road
Unhappy How to use AutoExec macro
     Word: VBA   


------ Register to get rid of these "In Post" ads! ------

Category: Word: VBA   

I want to use automatically the marco but not running.

the code:
VBA CODE:
Sub AutoExec() 
    MsgBox "You're seeing the AutoExec macro in action", vbMsgBoxSetForeground 
End Sub 


Someone can help ?

Many thanks in advance.

The Code Cage Advertisment
Advertisement
  #2  
Unread 25th November 2014, 02:52
macropod's Avatar
macropod macropod is offline
Solution Centre Professional
MS Office Version: MS Office 2000, 2003 & 2010
MS Office Skill Level: Proficient with MS Office
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 172
Posts Per Day: 0.08
My Top Tip Count: 0
Thanks to others: 0
Thanked 20 Times in 20 Posts
Reputation: 380 (11) macropod is just really nicemacropod is just really nicemacropod is just really nicemacropod is just really nice
Australia
Default Re: How to use AutoExec macro

------ Register to get rid of these "In Post" ads! ------


You haven't provided enough details about how you're trying to use this for anyone to provide meaningful advice. For general advice, see: http://msdn.microsoft.com/en-us/libr...ffice.11).aspx
__________________
Cheers,
Paul Edstein
[MS MVP - Word]

  #3  
Unread 28th November 2014, 21:12
xuhathdo's Avatar
xuhathdo xuhathdo is offline
Junior Member
MS Office Version: MS Office 2003
MS Office Skill Level: New to Access
 
Join Date: Apr 2014
Location: An Giang, Vietnam
Age: 32
Posts: 5
Posts Per Day: 0.00
My Top Tip Count: 0
Thanks to others: 0
Thanked 0 Times in 0 Posts
Reputation: 10 (3) xuhathdo is on a distinguished road
Default Re: How to use AutoExec macro

------ Register to get rid of these "In Post" ads! ------


Thank you for your reply ! I done true that "A procedure in any module is named after the auto macro" but it not run.

The Code Cage Advertisment
Advertisement
  #4  
Unread 28th November 2014, 22:18
macropod's Avatar
macropod macropod is offline
Solution Centre Professional
MS Office Version: MS Office 2000, 2003 & 2010
MS Office Skill Level: Proficient with MS Office
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 172
Posts Per Day: 0.08
My Top Tip Count: 0
Thanks to others: 0
Thanked 20 Times in 20 Posts
Reputation: 380 (11) macropod is just really nicemacropod is just really nicemacropod is just really nicemacropod is just really nice
Australia
Default Re: How to use AutoExec macro

------ Register to get rid of these "In Post" ads! ------


You still haven't provided any meaningful detail.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]

  #5  
Unread 29th November 2014, 09:52
RoyUK's Avatar
RoyUK RoyUK is offline
Administrator
Solution Centre Professional
MS Office Version: MS Office 2003, 2007, 2010
MS Office Skill Level: Proficient with MS Office
 
Join Date: Nov 2008
Location: Derbyshire, UK
Posts: 2,705
Posts Per Day: 0.88
My Top Tip Count: 4
Thanks to others: 2
Thanked 195 Times in 193 Posts
Reputation: 3320 (69) RoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond repute
4 Top Tips
England
Default Re: How to use AutoExec macro

------ Register to get rid of these "In Post" ads! ------


You aren't helping us to help you.

Why do you want to run an autoexex macro in Excel. I think you should be using the WorkBook_Open event.

I don't believe Excel has an AutoExec like Access but did have Sub Auto_Open() for backward compatability
__________________
Hope that helps, RoyUK
For tips & examples visit free excel help
DatabaseForm
About me

  #6  
Unread 29th November 2014, 11:57
macropod's Avatar
macropod macropod is offline
Solution Centre Professional
MS Office Version: MS Office 2000, 2003 & 2010
MS Office Skill Level: Proficient with MS Office
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 172
Posts Per Day: 0.08
My Top Tip Count: 0
Thanks to others: 0
Thanked 20 Times in 20 Posts
Reputation: 380 (11) macropod is just really nicemacropod is just really nicemacropod is just really nicemacropod is just really nice
Australia
Default Re: How to use AutoExec macro

------ Register to get rid of these "In Post" ads! ------


Quote:
Originally Posted by RoyUK View Post

Why do you want to run an autoexex macro in Excel. I think you should be using the WorkBook_Open event.

I don't believe Excel has an AutoExec like Access but did have Sub Auto_Open() for backward compatability

What makes you think this has anything to do with Excel?
__________________
Cheers,
Paul Edstein
[MS MVP - Word]

The Code Cage Advertisment
Advertisement
  #7  
Unread 29th November 2014, 15:09
RoyUK's Avatar
RoyUK RoyUK is offline
Administrator
Solution Centre Professional
MS Office Version: MS Office 2003, 2007, 2010
MS Office Skill Level: Proficient with MS Office
 
Join Date: Nov 2008
Location: Derbyshire, UK
Posts: 2,705
Posts Per Day: 0.88
My Top Tip Count: 4
Thanks to others: 2
Thanked 195 Times in 193 Posts
Reputation: 3320 (69) RoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond repute
4 Top Tips
England
Default Re: How to use AutoExec macro

------ Register to get rid of these "In Post" ads! ------


I didn't notice it was a Word question, but Word has a Document_Open event
__________________
Hope that helps, RoyUK
For tips & examples visit free excel help
DatabaseForm
About me

  #8  
Unread 29th November 2014, 21:10
macropod's Avatar
macropod macropod is offline
Solution Centre Professional
MS Office Version: MS Office 2000, 2003 & 2010
MS Office Skill Level: Proficient with MS Office
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 172
Posts Per Day: 0.08
My Top Tip Count: 0
Thanks to others: 0
Thanked 20 Times in 20 Posts
Reputation: 380 (11) macropod is just really nicemacropod is just really nicemacropod is just really nicemacropod is just really nice
Australia
Default Re: How to use AutoExec macro

------ Register to get rid of these "In Post" ads! ------


Yes, but AutoExec and Document_Open do different things. Document_Open is the equivalent of AutoOpen.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]

  #9  
Unread 30th November 2014, 09:57
RoyUK's Avatar
RoyUK RoyUK is offline
Administrator
Solution Centre Professional
MS Office Version: MS Office 2003, 2007, 2010
MS Office Skill Level: Proficient with MS Office
 
Join Date: Nov 2008
Location: Derbyshire, UK
Posts: 2,705
Posts Per Day: 0.88
My Top Tip Count: 4
Thanks to others: 2
Thanked 195 Times in 193 Posts
Reputation: 3320 (69) RoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond reputeRoyUK has a reputation beyond repute
4 Top Tips
England
Default Re: How to use AutoExec macro

------ Register to get rid of these "In Post" ads! ------


As far as I am aware an AutoExec macro runs at start up so the end result is pretty much the same.

There does seem to be a difference according to this. After reading this it looks like the AutoExec runs when Word is opened whereas Auto_Open runs when the document containing it is opened.
__________________
Hope that helps, RoyUK
For tips & examples visit free excel help
DatabaseForm
About me

The Code Cage Advertisment
Advertisement
  #10  
Unread 30th November 2014, 14:10
Jack in the UK's Avatar
Jack in the UK Jack in the UK is offline
The Code Cage Staff
MS Office Version: MS Office 97, 2003, 2007,2010
MS Office Skill Level: Proficient with Excel
 
Join Date: Dec 2011
Location: England
Posts: 545
Posts Per Day: 0.28
My Top Tip Count: 0
Thanks to others: 3
Thanked 43 Times in 43 Posts
Reputation: 570 (16) Jack in the UK is a name known to allJack in the UK is a name known to allJack in the UK is a name known to allJack in the UK is a name known to allJack in the UK is a name known to allJack in the UK is a name known to all
England
Default Re: How to use AutoExec macro

------ Register to get rid of these "In Post" ads! ------


Interesting, ok Jacks input
AutoExec – AutoExec.exe is a M$ Windows file that run for all sorts of start-up process, executing scripts and process to set the WorkStation all up nice and correct, same goes in old M$ Win days installing base O/S from floppy (floppy / CD)
The general idea was to code in the required bits and bobs so everything runs when the computers turned on, AutoExec is a very late running part of this total set up, however we the User never see much just stuff flickering on the monitor and scrolling etc…
SO .. in VBA we have start up declarations to do the same only if the user allows macros to run, else they do not, this is a very old security setting to stop hostile codes running from MR x or Mr y that set You a iffy file
That’s the thinking. To answer more
In M$ Excel we use
VBA CODE:
Private Sub Workbook_Open() 
End Sub 

So the fix will be to call the macro Auto_Open if you want it to execute it when you open it
If you want it to execute when you close the file (such as to automatically save changes) call it Auto_Close
That’s the only real way I have never see this in M$ Excel before as its seem to with M$ Access and M$ Word
I do not think you will solve this in the way You are hoping
Regards
Jiuk

Only thing I can think of is –

Excel 1997 and up...there is still "help" on "Personal Macro Workbook" but a crude way to go around this problem is to save the Excel file containing the sub Auto_Open() in the directory, not Workbook_Open as I explained earlier

\\ "..\Office\XlStart"
__________________
VBA CODE:
Regards, 
Jack In the UK 

The Code Cage Advertisment
Advertisement

To stop seeing these ads and get other benefits check This page!

New Reply
The Code Cage at Facebookhe Code Cage at Twitter


Tags
autoexec, macro

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

The Code Cage Affilliates



http://www.thecodecage.com/forumz tested by McAfee Security http://www.thecodecage.com/forumz tested by McAfee Security

All times are GMT +1. The time now is 08:15.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Template-Modifications by TMS
No part of this board, functionality or creatives may be copied or reproduced either in part or full without the express permission of The Code Cage Team.
Copyright ©2008 - , Simon lloyd.
We are not associated with nor employed by Microsoft in any way, we simply provide resources!
All MS office icons are registered trademarks of the application they represent and are used with permission from Microsoft
UA-8135493-1
Cultural Forum | Study at Malaysian University