A
Alex Bendig
Everyone,
I have a valid reference to a PowerPoint.Presentation object. I'd like to
programmatically create a macro and have that available during program
runtime.
As far as I can tell, this should do the trick:
currentPresentation.VBProject.VBComponents.Add(VBIDE.vbext_ComponentType.vbe
xt_ct_StdModule);
string s = "sub vbaSwitchToMaster()\r\n"+
"currentPresentation.Windows.Item(1).ViewType =
PowerPoint.PpViewType.ppViewTitleMaster\r\n"+
"end sub";
vbc.CodeModule.AddFromString(s);
Unfortunately, it does not.
In fact, this test line fails already:
Console.WriteLine(currentPresentation.VBProject);
Instead, this exception is being thrown (unfortunately):
An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in WindowsApplication5.exe
Additional information: Exception from HRESULT: 0x80048240.
I am confused. Certainly, I would appreciate any sort of constructive
hint/suggestion/etc. which may shed some light on the matter.
Thanks in advance and best regards,
Alex Bendig
I have a valid reference to a PowerPoint.Presentation object. I'd like to
programmatically create a macro and have that available during program
runtime.
As far as I can tell, this should do the trick:
currentPresentation.VBProject.VBComponents.Add(VBIDE.vbext_ComponentType.vbe
xt_ct_StdModule);
string s = "sub vbaSwitchToMaster()\r\n"+
"currentPresentation.Windows.Item(1).ViewType =
PowerPoint.PpViewType.ppViewTitleMaster\r\n"+
"end sub";
vbc.CodeModule.AddFromString(s);
Unfortunately, it does not.
In fact, this test line fails already:
Console.WriteLine(currentPresentation.VBProject);
Instead, this exception is being thrown (unfortunately):
An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in WindowsApplication5.exe
Additional information: Exception from HRESULT: 0x80048240.
I am confused. Certainly, I would appreciate any sort of constructive
hint/suggestion/etc. which may shed some light on the matter.
Thanks in advance and best regards,
Alex Bendig