G
GB
I am just messing around, trying to get to grips with VBA. Some of it seems
quite simple, other bits annoyingly frustrating.
I have a couple of spreadsheets I am working on just to teach myself VBA. On
a whim, really, I thought it would be helpful to get the spreadsheets to
fire up the VBA editor and go to the code modules as soons as it is opened.
Just to take things one at a time, I stuck the following code into a
Workbook module
Private Sub Workbook_Open()
MsgBox "Hello"
End Sub
Now, I kind of expected that this would immediately say hello to me when I
open the workbook - but it does not do so. Can someone explain why not?
Please! What am I doing wrong?
If I can get that to work, I was going to replace the MsgBox command (am I
allowed to say command any longer?) with
Sendkeys "%(F11)(F7)"
Should that work?
Thanks
Geoff
quite simple, other bits annoyingly frustrating.
I have a couple of spreadsheets I am working on just to teach myself VBA. On
a whim, really, I thought it would be helpful to get the spreadsheets to
fire up the VBA editor and go to the code modules as soons as it is opened.
Just to take things one at a time, I stuck the following code into a
Workbook module
Private Sub Workbook_Open()
MsgBox "Hello"
End Sub
Now, I kind of expected that this would immediately say hello to me when I
open the workbook - but it does not do so. Can someone explain why not?
Please! What am I doing wrong?
If I can get that to work, I was going to replace the MsgBox command (am I
allowed to say command any longer?) with
Sendkeys "%(F11)(F7)"
Should that work?
Thanks
Geoff