 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Nico Callewaert Guest
|
Posted: Wed Nov 26, 2003 2:57 pm Post subject: Adding a Workbook_BeforePrint event |
|
|
Hi,
I've made a VBA event in Excel : Workbook_BeforePrint.
How can I automatically insert that in a sheet through
Delphi-automation ?
Many thanks, Nico Callewaert
|
|
| Back to top |
|
 |
Nico Callewaert Guest
|
Posted: Wed Nov 26, 2003 9:04 pm Post subject: Re: Adding a Workbook_BeforePrint event |
|
|
Hi again,
I found already the solution to my macro problem, but
now I have another question : is it possible to delete
a inserted macro after the job is finished ?
Thanks in advance, Nico Callewaert
"Nico Callewaert" <nico_callewaert (AT) hotmail (DOT) com> wrote:
| Quote: |
Hi,
I've made a VBA event in Excel : Workbook_BeforePrint.
How can I automatically insert that in a sheet through
Delphi-automation ?
Many thanks, Nico Callewaert
|
|
|
| Back to top |
|
 |
David Guest
|
Posted: Thu Nov 27, 2003 7:32 am Post subject: Re: Adding a Workbook_BeforePrint event |
|
|
var
VBC : _VBComponent;
cm : CodeModule;
i : integer;
begin
VBC :=
ExcelApplication.VBE.ActiveVBProject.VBComponents.Add(vbext_ct_StdModule);
cm := VBC.CodeModule;
// goto the end of the CodeModule
i := cm.CountOfLines;
cm.InsertLines(2 + i, 'Sub YourMacro');
...
cm.InsertLines(2 + i + 2, 'End Sub');
ExcelApplication.Run('YourMacro');
ExcelApplication.VBE.ActiveVBProject.VBComponents.Remove(VBC);
end;
this way you can run any macro and delete it.
Am 26 Nov 2003 14:04:19 -0700 hat Nico Callewaert
<nico_callewaert (AT) hotmail (DOT) com> geschrieben:
| Quote: |
Hi again,
I found already the solution to my macro problem, but
now I have another question : is it possible to delete
a inserted macro after the job is finished ?
Thanks in advance, Nico Callewaert
"Nico Callewaert" <nico_callewaert (AT) hotmail (DOT) com> wrote:
Hi,
I've made a VBA event in Excel : Workbook_BeforePrint.
How can I automatically insert that in a sheet through
Delphi-automation ?
Many thanks, Nico Callewaert
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|