When I open a spreadsheet, I want to create a macro dynamically and then execute it. The code doesn't need to be saved.
How can I do this?
When I open a spreadsheet, I want to create a macro dynamically and then execute it. The code doesn't need to be saved.
How can I do this?
http://www.cpearson.com/excel/vbe.htm
--
Kind regards,
Niek Otten
"klav" <klav.24bf9y_1141761606.8773@excelforum-nospam.com> wrote in message
news:klav.24bf9y_1141761606.8773@excelforum-nospam.com...
>
> When I open a spreadsheet, I want to create a macro dynamically and then
> execute it. The code doesn't need to be saved.
>
> How can I do this?
>
>
> --
> klav
> ------------------------------------------------------------------------
> klav's Profile:
> http://www.excelforum.com/member.php...o&userid=17844
> View this thread: http://www.excelforum.com/showthread...hreadid=519869
>
It can be done, but it requires code to do it, so instead of having the
code-creation code, why not just store the code to be created. It's a lot
simpler.
--
HTH
Bob Phillips
(remove nothere from email address if mailing direct)
"klav" <klav.24bf9y_1141761606.8773@excelforum-nospam.com> wrote in message
news:klav.24bf9y_1141761606.8773@excelforum-nospam.com...
>
> When I open a spreadsheet, I want to create a macro dynamically and then
> execute it. The code doesn't need to be saved.
>
> How can I do this?
>
>
> --
> klav
> ------------------------------------------------------------------------
> klav's Profile:
http://www.excelforum.com/member.php...o&userid=17844
> View this thread: http://www.excelforum.com/showthread...hreadid=519869
>
You need to decide what you want the macro to do. In your workbook section
you then create an on open event, which will then run whenever you open the
file. For a macro to run, it needs to be recorded, (saved). It really makes
no sense to write a macro, run it, kill it and repeat this every time you
open a file!
"klav" wrote:
>
> When I open a spreadsheet, I want to create a macro dynamically and then
> execute it. The code doesn't need to be saved.
>
> How can I do this?
>
>
> --
> klav
> ------------------------------------------------------------------------
> klav's Profile: http://www.excelforum.com/member.php...o&userid=17844
> View this thread: http://www.excelforum.com/showthread...hreadid=519869
>
>
If there's enough information to dynamically create a macro and run it then
you probably have what you need to carry out the same operations as the
"dynamic" macro without first having to create it...
What is the macro for ?
Tim
"klav" <klav.24bf9y_1141761606.8773@excelforum-nospam.com> wrote in message
news:klav.24bf9y_1141761606.8773@excelforum-nospam.com...
>
> When I open a spreadsheet, I want to create a macro dynamically and then
> execute it. The code doesn't need to be saved.
>
> How can I do this?
>
>
> --
> klav
> ------------------------------------------------------------------------
> klav's Profile:
> http://www.excelforum.com/member.php...o&userid=17844
> View this thread: http://www.excelforum.com/showthread...hreadid=519869
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks