implant macro
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Implant macro

Implant macro

resolvedResolved · High Priority · Version 2007

replyReply Sat 11 Dec 2010, 07:46Delegate Tom said...

Implant macro

I am creating a new wookbook via code. I want to set up a macro plus macro button on the new code-created workbook. How can I 'implant' the macro?

For upcoming training course dates see: Pricing & availability

replyReply Wed 15 Dec 2010, 12:51Trainer Anthony said...

RE: implant macro

Hi Tom, thanks for your query. Easiest way to quickly for this is...to record yourself doing precisely that as a macro! Here's the code I got from doing a quick macro of my actions:

ActiveSheet.Buttons.Add(218.25, 81.75, 117.75, 24).Select
Selection.OnAction = "mymacro"

Bit of an anti-climax, isn't it?!

Hope this helps,

Anthony

replyReply Fri 17 Dec 2010, 07:56Delegate Tom said...

RE: implant macro

Thanks, Anthony.

Very helpful; i.e. works.

Anti-climax? Yes and no; it opens many doors.

Regards,

Tom

replyReply Fri 17 Dec 2010, 11:47Trainer Anthony said...

RE: implant macro

No problem Tom. Two lines of code, but a lot of potential. I hope it proves useful.

Anthony

 

Please browse our web site to find out more about
excel consulting and other Microsoft training courses.

Excel tip:

Move data worksheet to worksheet

To move data from one worksheet to another, highlight the data.

Select and hold down the ALT key and position the mouse on the border of the selection until the mouse pointer displays four-headed arrows.

Drag the selection down to the destination worksheet tab.

When the arrow touches the tab, Excel switches to the desired worksheet. Now drag the selection to the correct position. Let go of the mouse and then the ALT key.

To copy data from one worksheet to another, select and hold down the CTRL+ALT keystroke combination and perform the steps above.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard