473,473 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

programmatically creating powerpoint macro

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(VBI DE.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
Nov 13 '05 #1
0 3094

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Levi | last post by:
How can I use php and mysql to create a downloadable .ppt file from the php-made output?
0
by: kevininstructor | last post by:
I found a good example at Microsoft but appear to have some slight problems. Example @ Microsoft http://support.microsoft.com/default.aspx?scid=kb;EN-US;303717 Note:I followed all the...
2
by: WillRead | last post by:
I have a VB.Net application and a PowerPoint presentation explaining how each form in the application works, etc.. I would like to select and display the slide appropriate for each form by pressing...
7
by: Bob Day | last post by:
Using VS 2003... Is there a way to create a tif file on the fly to be faxed? I need a simply cover page (simple logo, to/from, etc.) and am currently doing it in text only, but that doesn't...
1
by: Vinit | last post by:
Hi Just like we can use VBA and create a Macro in VB for Microsoft Powerpoint. Can we also write a macro in c# ??Does powerpoint support this? Thanks, Vinit
0
by: CodeHulk | last post by:
This is an office automation project. I am currently working on a document control project tracking powerpoint, word, and excel documents. The documents are required to have a specific style of...
1
by: EmmettBrown | last post by:
Hello, Just wondering if anyone can advise. I am trying to remotely control Powerpoint using a microprocessor. I am using RS232 (COM1). The idea is that the microprocessor sends ASCII strings...
1
by: nushi | last post by:
Does any one know how i can get the shape name or text inside the shape when the user click on it and i active a macro? i need to know that on the macro itself... thenks :)
2
by: LucasLondon | last post by:
Hi, I'm trying to use VBA to extract underlying data from charts in powerpoint to excel, i.e from the underlying powerpoint datasheet that feeds the chart. I've found the macro below on the...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.