implant macro

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

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

Implant macro

resolvedResolved · High Priority · Version 2007

Tom has attended:
Excel VBA Intro Intermediate course
Excel Advanced course
Excel VBA Advanced course
Access Introduction course

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?

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

RE: implant macro

Thanks, Anthony.

Very helpful; i.e. works.

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

Regards,

Tom

RE: implant macro

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

Anthony

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Difference between Two Dates

The DATEDIF function computes the difference between two dates. The DATEDIF function is as follows:

=DATEDIF (Date1,Date2,Interval)

Please note that Date1 must be less than (earlier) or equal to Date2

Please note that Interval must be one of the following codes: "d" (in days), "m" (in months), "y" (in years) expressed in quotes


View all Excel hints and tips


Server loaded in 0.07 secs.