Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use workbook open event of the workbook:
Private Sub Workbook_Open() Application.Dialogs(xlDialogNew).Show End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Open Macro Dialog Box | Excel Programming | |||
control of dialog macro dialog box. on open | Excel Programming | |||
end Macro after cancelling open dialog | Excel Programming | |||
Open file Dialog box in Macro | Excel Programming | |||
Open dialog in macro | Excel Programming |