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!

Copying Macros Across to Sheet???

Status
Not open for further replies.

simoncpage

Programmer
Apr 4, 2002
256
GB
I have worked out how to copy macros from one sheet to another but how the earth to you write macros to a sheet. I have a beforeright click module that replaces the right click menu but unless I can copy across the coding I cant see anyway around this???

Any help would be most appreciated, Thanks

Simon
 
Simon,
Download this file from my web site.


(ignore the rest of it! it's basically a test and deposit site!)

it won't help you with writing to sheets, but it will help you with replacing your shortcut menu.

Ben ----------------------------------
Ben O'Hara
bo104@westyorkshire.police.uk
----------------------------------
 
I cant look at this at the moment as Im on a client workstation at college and they havent got winzip installed...Could you explain how this works can I add it straight into a workbook without having to install any activex components..i.e if I send the workbook to someone it will work straight from the workbook?

Thanks

Simon
 
I've never used it myself, I've had the addin hanging around for ages.
From what I can see, it doesn't remove the old shortcut menu, it just adds a new list to it.

Here's the basics of the code. It doesn't use anything other than XL code, so you "should" be ok!

Dim t As Object

Set t = Application.ShortcutMenus(xlWorksheetCell).MenuItems.AddMenu("My Special &Menu", 1)

t.MenuItems.Add "2nd Samp&le Option", _
"'Add2ShortCutMenu.xla'!MyCustomFunction_Two", , 1, , _
"Click on the sample option of the shortcut menu"

t.MenuItems.Add "1st &Sample Option", _
"'Add2ShortCutMenu.xla'!MyCustomFunction_One", , 1, , _
"Click on the sample option of the shortcut menu"

This function is called on the "OnOpen" event so that it is loaded with the workbook.

Hope that gets you started.

Ben ----------------------------------
Ben O'Hara
bo104@westyorkshire.police.uk
----------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top