PDA

View Full Version : Run code on workbook open



MrAshton
01-30-2009, 05:35 PM
Im implementing various excell based forms into sharepoint as content types so that when users select "new" the excel template I have created, automaticly opens with blank fields. I'd like to know how I can get some code to run on workbook open. I think it's a pretty simple bit of code that would do the trick but I can't seem to find it.

Thanks in advance for your help!

Paul_Hossler
01-30-2009, 06:46 PM
Workbook.Open EventOccurs when the workbook is opened

In the VBA Project Explorer, double click "This Workbook" on the left, and then from the right code window, change "(General)" to "Workbook"

The code does not go into a regular Module



Syntax
expression.Open
expression An expression that returns a Workbook object.

Example
This example maximizes Microsoft Excel whenever the workbook is opened.

Private Sub Workbook_Open()
Application.WindowState = xlMaximized
End Sub



Paul