run vba automatically

R

R.H.

I am new to vba programming with excel though I have used visual basic. I
was wondering, can I design a form based project and have it execute
automatically when the spread sheet is opened or do you always have to go to
tools->macros->visual basic editor and then press the run button on the tool
bar.

Roger
 
R

R.H.

Thanks, but I added the subroutine as you suggested, but it does not run
automatically when I open the excel workbook. I still have to go to
tools, then macros, then visual basic editor and press the run button.

Roger
 
T

TroyW

This sub needs to be in the ThisWorkbook code page.

Private Sub Workbook_Open()
'Put code to execute when the workbook is opened, here.

End Sub

The user still needs to click on the "Enable Macros" button when they are
prompted during the file opening (provided they have low or medium security
setting).

Troy
 
T

TroyW

I meant to say...

The user still needs to click on the "Enable Macros" button when they are
prompted during the file opening (provided they have medium security
setting).

Troy
 
Top