ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is there any onLoad kind of function for Excel (https://www.excelbanter.com/excel-programming/294671-there-any-onload-kind-function-excel.html)

sameerce

Is there any onLoad kind of function for Excel
 
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

--
Message posted from http://www.ExcelForum.com


Stevie_mac

Is there any onLoad kind of function for Excel
 
In VBA Environment, in the 'Workbook' add the following ...
Private Sub Workbook_Open()
'Do stuff in here
End Sub


"sameerce " wrote in message ...
Please help,
I am a novice to Excel programming. I wanted to define some variables
and give their initial values and also add some form controls on
loading of the Excel sheet. Is it possible to do it?

Thanks
Sameer


---
Message posted from http://www.ExcelForum.com/




Bob Phillips[_6_]

Is there any onLoad kind of function for Excel
 
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)

"sameerce " wrote in message
...
Please help,
I am a novice to Excel programming. I wanted to define some variables
and give their initial values and also add some form controls on
loading of the Excel sheet. Is it possible to do it?

Thanks
Sameer


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 10:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com