View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bill Manville Bill Manville is offline
external usenet poster
 
Posts: 473
Default Opening properties box

Steveb wrote:
Is there anyway of having the properties dialog box open up automatically
when starting a blank spreadsheet?


The code is easy:
Application.Dialogs(xlDialogProperties).Show

The question is how to make it run.

You could put it in Workbook_Open in a workbook template BOOK.XLT in your
XLSTART directory - but then you will get the macro virus warning when you
create a new workbook. Also you would need to arrange for it only to run
on first open

If ThisWorkbook.Path = "" Then
Application.Dialogs(xlDialogProperties).Show
End If

Better would be to make an application-level event handler in your
PERSONAL.XLS detect a new workbook.
In Personal.xls (or some other workbook in your XLSTART directory):
- Insert / Class Module
- name it clsApp (for example)
- paste in this code:

Public WithEvents oXL As Excel.Application

Private Sub oXL_NewWorkbook(ByVal Wb As Excel.Workbook)
If Wb.Path = "" Then
Application.Dialogs(xlDialogProperties).Show
End If
End Sub

- Insert / Module
- paste in the following code:


Dim clsXL As New clsApp

Sub Auto_Open()
Set clsXL.oXL = Application
End Sub

Sub Auto_Close()
Set clsXL = Nothing
End Sub

- save the workbook
- run Auto_Open
- create a new workbook (to test it out).






Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup