Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assigning Macros To menu items

Status
Not open for further replies.
Jun 6, 2001
26
AU
I am using excel 5 and was wondering how I can assign macro to the close option on the file menu. Also wondering if there is something similar in excel to the autoexec macro in access.

Also I want to create buttons on the worksheet that do the same action as selecting a menu option....eg opening the insert notes dialogue box.

Thanks for any help somebody might provide!
 

Sub Auto_Open()
Msgbox "This is similar to the Access Autoexec"
End Sub

Sub Auto_Close()
Msgbox "This will execute when the user closes the workbook"
End Sub

Hint: Record a Macro while you insert a note to a cell. When finished you can look at the code it generated and edit it to make it more dynamic.
 
thanks for that. I should have mentioned that I had tried the macro recorder for the notes dialogue box. It doesn't work. The NoteText property/method only adds notes, it doesn't open the dialogue box. I am using notes to keep a running history on changes in parameters for a computer system, I just want to add buttons to the cells to open the notes dialogue box for the selected cell. Any other ideas?
 

I am using Office 2000 so not sure that the follwoing code will work for you in Excel 5.0. You might like to give it a try anyway and see if it points you to something.


Sub Sample()
ActiveCell.Comment.Visible = True
End Sub

Older versions of Excel may have refered to the comment object as a Note ? If so then you might try:

ActiveCell.Note.Visible = True
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top