Is there any onLoad kind of function for Excel

S

sameerce

Please help,
I am a novice to Excel programming. I wanted to define some variable
and give their initial values and also add some form controls o
loading of the Excel sheet. Is it possible to do it?

Thanks
Samee
 
S

Stevie_mac

In VBA Environment, in the 'Workbook' add the following ...
Private Sub Workbook_Open()
'Do stuff in here
End Sub
 
B

Bob Phillips

Sameer,

More detail would be helpful, such as when do those variable need to be
initialised, and will they be used in one macro. or many.

You could create public constants and assign values if the value will never
change, or public variables if they are required in many macros. In
idealisation could be done in the Workbook_Open event or at the start of a
procedure.

As for the controls, it is probably better not to create the controls when a
sheet is loaded, it could be loaded many times, but add them manually, and
then just use them in the sheet.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top