Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Excel Macro Advise.....To Open The Template Dialog.....

I am using Excel 2002 and 2003 and get diferent results from this macro.
Using a macro to open the Templates Dialog.....Advise Please.

Sub AutoExec( )

Application.Dialogs(xlDialogNew).Show

End Sub

When Running from within the VBE of Excel 2003 it will work ...Open the
Dialog Box.
but it will not run on startup as expected of an AutoExec.

When Running on Excel 2002, it doesn't appear to run al all fron within the
VBE to test it or on Startup.
If I step through it in the VBE, nothing happens.

All suggestions would be appreciated. Thanks



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Excel Macro Advise.....To Open The Template Dialog.....

Use workbook open event of the workbook:

Private Sub Workbook_Open()
Application.Dialogs(xlDialogNew).Show
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Excel Macro Advise.....To Open The Template Dialog.....

Hi Brian
Thanks for the reply.
I opened a new workbook.
Tools | Macros | VBE | View Code....I also have project explorer showing in
the left pane.
I have copied and pasted the code you supplied into a new workbook to test it.
When I click on the Run Triangle icon in the toolbar nothing happens. If I
step through it nothing happens.
Can you suggest what I might be doing wrong?

Please explain what the difference is between the code you have given me
and what I was using as posted in my first posting.
Your help is appreciated as I know I must be doing something silly wrong.

"Brian Taylor" wrote:

Use workbook open event of the workbook:

Private Sub Workbook_Open()
Application.Dialogs(xlDialogNew).Show
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Excel Macro Advise.....To Open The Template Dialog.....

You have to make sure to put it in the workbook code section. Go into
the VBE and and instead of putting the code in a regular module, double
click on ThisWorkbook in the project explorer. This should open the
code section for the workbook. Paste the code in that section.

An even better method is, once you open the workbook code section, if
you click on the drop down that says general and change that to
workbook then you will get a list of event triggers in the second drop
down. You can select open from that list and it will create the
workbook_open event sub header for you. Let me know if my explanation
makes sense.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Excel Macro Advise.....To Open The Template Dialog.....



"Brian Taylor" wrote:

You have to make sure to put it in the workbook code section. Go into
the VBE and and instead of putting the code in a regular module, double
click on ThisWorkbook in the project explorer. This should open the
code section for the workbook. Paste the code in that section.

An even better method is, once you open the workbook code section, if
you click on the drop down that says general and change that to
workbook then you will get a list of event triggers in the second drop
down. You can select open from that list and it will create the
workbook_open event sub header for you. Let me know if my explanation
makes sense.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Excel Macro Advise.....To Open The Template Dialog.....

Hi Brian
I followed your instruction to insert the code in this workbook, selected
Workbook from the General Drop down and Open from the Event dropdown.
Then I inserted the code: Application.Dialogs(xlDialogNew).Show betwen the
open heading and End Sub.
When I run it....nothing happens.....did this work for you?

What I am trying to do is get the Template dialog box to open when I open
excel....I can then select the appropriate template I want to use from the
dialog box.

I can get similar code to work for Word 2002 / 2003 as shown below.
Sub AutoExec()
'
' AutoExec Macro to open the template Dialogue Box
' Macro created 25/02/2006 by Dermot Hayes
'
Dialogs(wdDialogFileNew).Show

End Sub

Any other help would be appreciated.

"Brian Taylor" wrote:

You have to make sure to put it in the workbook code section. Go into
the VBE and and instead of putting the code in a regular module, double
click on ThisWorkbook in the project explorer. This should open the
code section for the workbook. Paste the code in that section.

An even better method is, once you open the workbook code section, if
you click on the drop down that says general and change that to
workbook then you will get a list of event triggers in the second drop
down. You can select open from that list and it will create the
workbook_open event sub header for you. Let me know if my explanation
makes sense.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Excel Macro Advise.....To Open The Template Dialog.....

Dermot,

This code worked for me both when I stepped through it one line at a
time and also when I opened the workbook. Try testing the
workbook_open event by putting something really simple in there like
msgbox "Hello!" and see if it works. Let's find out if it is the
workbook open event or the dialogs call that is failing. I am also
working in excel 2000, but I don't think Microsoft introduced another
method for opening dialogs in 2002.

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
Open Macro Dialog Box Steven Excel Programming 1 July 26th 04 10:34 PM
control of dialog macro dialog box. on open Gerry Abbott Excel Programming 0 July 22nd 04 05:41 PM
end Macro after cancelling open dialog No Name Excel Programming 1 June 29th 04 08:58 AM
Open file Dialog box in Macro Joshua Excel Programming 6 April 4th 04 01:44 AM
Open dialog in macro Matt Excel Programming 1 February 21st 04 06:34 PM


All times are GMT +1. The time now is 02:11 AM.

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"