Link to other slides from table using c#

Hi,

I'm looking to create links from a certain slide to another, and I need 
those links to be from within a table.

I need it to be something like this:

 

var
 pptApp = new
 PowerPoint.Application();

var
 presentation = pptApp.Presentations.Add(Office.MsoTriState.msoFalse);
var
 slides = presentation.Slides;
            
slides.InsertFromFile(@"C:\Users\Tng1\Documents\PresentationTemplate.potx"
, 0, 1);
var
 titleSlide = slides[1];
titleSlide.Name="TitleSlide"
;

var
 tableSlide = slides[2];
tableSlide.Name = "TableSlide"
;
var
 shapes = tableSlide.Shapes;
var
 table = shapes[2].Table;
var
 cellTextFrame = table.Cell(1, 1).Shape.TextFrame;
cellTextFrame.TextRange.Text = "Link To Title Slide"
;
var
 cellAction = 
cellTextFrame.TextRange.ActionSettings[PowerPoint.PpMouseActivation.ppMouseClick];
cellAction.Action = PowerPoint.PpActionType.ppActionHyperlink;
cellAction.Hyperlink.Address = "titleSlide"
;

presentation.SaveAs(@"C:\Users\Tng1\Documents\Presentation.pptx"
, PowerPoint.PpSaveAsFileType.ppSaveAsOpenXMLPresentation, 
Office.MsoTriState.msoTrue);

However, when i set the action property:

var
 cellAction = 
cellTextFrame.TextRange.ActionSettings[PowerPoint.PpMouseActivation.ppMouseClick];
cellAction.Action = PowerPoint.PpActionType.ppActionHyperlink;

It throws the 0x80004005 COM exception.
I should tell you that when doing this in a simple text frame (not from a 
table) it works.

I'm using Office Enterprise 2007, and have reproduced the problem on XP SP3 
with VS 2008 Team Edition, and on Win7 with VS 2010 RC.

Thanks,

Yoni
0
Utf
3/24/2010 1:26:05 PM
powerpoint 2011 articles. 0 followers. Follow

1 Replies
1616 Views

Similar Articles

[PageSpeed] 35

In article <1B9768B5-8DF4-417D-8962-9792AAF8BB5C@microsoft.com>, Yoni wrote:
> Hi,
> 
> I'm looking to create links from a certain slide to another, and I need 
> those links to be from within a table.
> 
> I need it to be something like this:
> 
>  
> 
> var
>  pptApp = new
>  PowerPoint.Application();
> 
> var
>  presentation = pptApp.Presentations.Add(Office.MsoTriState.msoFalse);
> var
>  slides = presentation.Slides;
>             
> slides.InsertFromFile(@"C:\Users\Tng1\Documents\PresentationTemplate.potx"
> , 0, 1);
> var
>  titleSlide = slides[1];
> titleSlide.Name="TitleSlide"
> ;
> 
> var
>  tableSlide = slides[2];
> tableSlide.Name = "TableSlide"
> ;
> var
>  shapes = tableSlide.Shapes;
> var
>  table = shapes[2].Table;
> var
>  cellTextFrame = table.Cell(1, 1).Shape.TextFrame;
> cellTextFrame.TextRange.Text = "Link To Title Slide"
> ;
> var
>  cellAction = 
> cellTextFrame.TextRange.ActionSettings[PowerPoint.PpMouseActivation.ppMouseClick];
> cellAction.Action = PowerPoint.PpActionType.ppActionHyperlink;
> cellAction.Hyperlink.Address = "titleSlide"
> ;
> 
> presentation.SaveAs(@"C:\Users\Tng1\Documents\Presentation.pptx"
> , PowerPoint.PpSaveAsFileType.ppSaveAsOpenXMLPresentation, 
> Office.MsoTriState.msoTrue);
> 
> However, when i set the action property:
> 
> var
>  cellAction = 
> cellTextFrame.TextRange.ActionSettings[PowerPoint.PpMouseActivation.ppMouseClick];
> cellAction.Action = PowerPoint.PpActionType.ppActionHyperlink;
> 
> It throws the 0x80004005 COM exception.
> I should tell you that when doing this in a simple text frame (not from a 
> table) it works.
> 
> I'm using Office Enterprise 2007, and have reproduced the problem on XP SP3 
> with VS 2008 Team Edition, and on Win7 with VS 2010 RC.


For a link w/in the same presentation, you'd want to set the Hyperlink.SubAddress 
rather than .Address

I don't C# (too much VBA has left me astigmatic, I guess), but in case it helps, 
this works (VBA):

  With ActivePresentation.Slides(1).Shapes("Table 3")
        With .Table
            With .Cell(1, 1).Shape.TextFrame
                With .TextRange
                .Text = "Link me here"
                With .ActionSettings(ppMouseClick)
                    .Action = ppActionHyperlink
                    .Hyperlink.SubAddress = "Two"
                End With
                End With
            End With
        End With
    End With

It creates a link to the second slide in the presentation, whose title text is 
"Two".

It'd be more reliable to use 

.Hyperlink.SubAddress = "257,2,"
or
.Hyperlink.SubAddress = ",2,"

257 is the SlideID of the slide you're linking to, 2 is the SlideIndex



==============================
PPT Frequently Asked Questions
http://www.pptfaq.com/

PPTools add-ins for PowerPoint
http://www.pptools.com/


0
Steve
3/24/2010 4:33:30 PM
Reply:

Similar Artilces:

Adding custom pages to Windows Control Panel using MFC
Hi, Is there anybody know how to add a custom page to Windows Control Panel using MFC? I found some code on Internet but that was written in Win32 API. Also tried to find the material on MSDN but the content is pretty old (if I am correct) : http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarvc/html/msdn_ntcplapp.asp Thanks. Is this what you're looking for? http://www.codeproject.com/shell/cpl.asp Tom <hugheslin@hotmail.com> wrote in message news:1145355183.002746.18420@z34g2000cwc.googlegroups.com... > Hi, > > Is there anybody know how to add a cus...

Pivot table will not returned value's
Goodmorning Everybody, Yesterday i made a macro which gets the value from Cell AM1 and fits it as a criteria in a Pivotfield in another file. The macro as seen at the end, works smooth except for this part: Set pt = Sheets("Table Combi").PivotTables("PivotTable3") Set pf = pt.PivotFields("ARF Code") ActiveSheet.PivotTables("PivotTable3").PivotFields("ARF Code").CurrentPage = "" & k & "" If pf.CurrentPage <> " & k & " Then pf.CurrentPage = "(Blank)" End If Does ...

HELP!!! Can't Apply Payment for Posted Invoice while Unposted in C
One user was entering in a transaction in the Sales Transaction Entry Window. She had not saved or put the transaction in a batch. The power went out, and she started up the computer when the power come back. She could not see the transaction in the Sales Transaction Entry for that Customer. She could see the transaction in the Collection Main window for that Customer but in the Unposted Sales. I tried to view the transaction from the SmartList but it is says it has been posted. So the user goes ahead and post thru the GL from the Series Post window. She still can not view t...

Tables/Queries
Hello, I've seen some posts regarding a similar problem to what I'm having but cant find the resolutution! I have a database with tableA which contains basic inventory info. I have a field in tableA named location. There is a second table (tableB) which has a list of all the locations our company delivers to. I've been warned to stay away from lookup fields, so I'm using combo boxes on the form to look up the location and then populate the location field in tableA when the value is selected. Here is the issue (and again, I've found some posts similar): Running a...

sql server 2000: most frequented tables -> script wanted
hallo, could someone please provide me a script, which throws the most frequented tables used within a sql server 2000 database? i am aware of one (see below) for sql server 2005, but due to new functionalities within sql server 2005 it can not be backported. SELECT TOP 20 db_name(database_ID), object_name(object_id), leaf_insert_count, leaf_delete_Count, leaf_update_count, range_scan_count, row_lock_count FROM sys.dm_db_index_operational_stats(NULL, NULL, NULL, NULL) WHERE db_name(database_ID)='<Datenbank-Name>' ORDER BY leaf_update_count desc --oder ...

Chart using Macro
I have several sheets having similar data for different lanes. I have a macro which can create a graph I want with different series plotted in different forms for source data on a particular sheet. I want to be able to create a graph for the active sheet. How do I use ActiveSheet data as source data for the gaph. ...

Query to Access : does'nt see tables
Office 2000 SP3 FR From Excel / MS Query, I want to read data in Access tables. I choose the mdb file and so MS Query displays this error message (translated) : "This data source does'nt have any visible table". Original in French : "Cette source de donn´┐Żes ne contient aucune table visible." I transfert my data to a new mdb file : it work's few times (!), then the error message appears again. How to resolve this problem ? Jacques. Gotcha ! MS Query does'nt accept a file name with 2 dot inside ! Example : MyFile.mdb --> Ok My.File.mdb --> "...

% of running total in pivot table
Does anyone know of a way to include in a pivot table a % of total for a running total. I'm not sure if I'm saying that right, so this is what I'm trying to do 1Day 2Days 3Days 4Days 5Days # completed 100 50 20 20 10 # completed (running total) 100 150 170 190 200 % completed (of running total) 50% 75% 85% 95% 100% The last row is what I'm struggling with. I can easily get ...

Outlook 2002
I use outlook 2002 on a Windows NT SP6a machine. While using outlook, i have noticed that sometimes the keys c, v, t and h stop working. however, i can use them in notepad. i can also use them in outlook if i put the caps lock on and use the shift key. if i restart outlook, the problem goes away. sometimes the problem goes away as well on its own without having to restart. any idea what is happening? language is set as english (Australia) ...

getting rid of linking errors...
hello every1, I am new to VC++. I have assignement in which i am trying to port VC 6 code to VC 2005. Although I removed some of the common errors, I am getting some linking errors while building the sol'n. These are as follows: LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library USBInfo.lib(USBInfoInterface.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) private: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Copy(unsigned int)&...

Summing a selection of lines in a pivot table
Hi all, Probably a totally newbie question on pivot tables but I can't seem to find out how it works. Here's my problem: I've got an Excel worksheet that (coming in from jet reports) contains something like #Asset 1 Description A1 Total A1 Mapping A1 = X1 #Asset 2 Description A2 Total A2 Mapping A2 = X1 #Asset 3 Description A3 Total A3 Mapping A3 = X2 #Liability 1 Description L1 Total L1 Mapping L1 = X3 #Liability 2 Description L2 Total L2 Mapping L2 = X4 #Liability 3 Description L3 Total L3 Mapping L3 = X4 This last field, mapping, is what's important for my pivot table; it...

VBA to export large tables from Excel to SQL Server
I have spreadsheets that I distribute to users. I want Excel VBA to export large tables (2000+ rows) into a remote SQL Server 2005. I am able to successfully do this with the following generic code, but it is too slow: Dim con As ADODB.Connection Set con = New ADODB.Connection con.Open "Driver={SQL Server};SERVER=<server>;DATABASE=TestSample;UID=<id>;PWD=<pw>;" con.Execute "INSERT INTO ... SELECT * FROM ..." 'Looping this for each row It takes over 10 minutes because it does it one line at a time. I've also tried l...

how to use RichInk control for Mobile word
Hi all, I am trying to view the word documents in Pocket PC. I got some MFC code in the following link. http://www.pocketpcdn.com/articles/word_embed.html It is doing well for reading Pocket PC 2003 word document (.psw). I tried this to read Mobile word ( Word document for WM 5.0).It showing some same invalid data for any input. If anybody has idea on it please help me.. Thank you, Supriya. ...

Relaying using AUTH
Someone had guess a weak password on one of my user accounts, and was using this with the AUTH command to relay messages off my Exchange 5.5 IMC. I enabled protocol logging, and saw the AUTH commands, and tracked down what account they were using with a base64 decoder and disabled the account. Now I want to find out what IP address these were originating from so I can repay the SOB. However, the protocol log only has hostnames where it says "accepting connection from hostname.domain.com". and the host names are bogus. I tested it, and it logs whatever you have entered a...

End Program Hanging...after using Money Deluxe
After using MS Money Deluxe, Win XP, All files are current and up to date : When I close Money and want to shut the computer down I get a message pop up, End Program : 5A25A898 THAT HANGS, Then I get another END PROGRAM: MCI Command Handling. Then I invoke Task Manager to end all tasks and the computer shuts down. Any suggestions. Thanks In Advance In microsoft.public.money, Birdflu wrote: >After using MS Money Deluxe, Win XP, All files are current and up to date : > >When I close Money and want to shut the computer down I get a message pop >up, End Program : 5A25A898 THAT...

Users of Apple Mail getting meeting requests as web links.
Apple Mail users of my Exchange server get invites as web links to the Exchange Web Access interface instead of .ics files. Can anyone point me to what setting I need to change in Exchange to make them be .ics files again? --Sterling Anderson ...

Add more than one series to a pivot chart using VB MS Access continued...
I'm trying to programmatically create a stacked bar pivot chart. Using "Programming Microsoft Office Access 2003" by Rick Dobson, I've created the chart. However, it doesn't distinguish between the different values for the series. Does anyone have any suggestions on how to create a chart using one column containing three values for the series? Essentially, this is a continuation of a previous post: http://groups.google.com/group/microsoft.public.access.formscoding/browse_thread/thread/e23f3506a6d561a0/674295d410a71cf9%23674295d410a71cf9" Any help is greatly appre...

A couple of newbie xsl conversion of xml to html questions (C#/.Net)
I have some xml data that I want to turn into an html report. I wrote some xsl (my first xsl) and tested it in XMLSpy. It transformed my xml to html pretty much how I wanted (I'm still trying to understand table formatting, like table width in xsl, my tables aren't as wide as I'm specifying). I want to use this transform in my c#/winforms/.net application I loaded some sample xml using XmlDocument Created an XPathNavigaor Loaded the xsl into XslTransform and used a XmlTextWriter along with XslTranform to write the html I have a handful of newbie questions a. The resulting htm...

Links Problem
I have a spreadsheet which contains links to other spreadsheets on m PC. When I send the spreadsheet to a friend and they open it and clic "Don't Update" they get errors where the linked formulas are. I thought that as long as you didn't try to update the links th spreadsheet should be OK and look the same as when it left m computer. HELP !!!!!!!!!!! :mad: :mad: :mad: :mad: :mad: :mad -- Hibbste ----------------------------------------------------------------------- Hibbster's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3016 View this thre...

using the time structure with MFC
Hi, Coming from C, how could I translate this into MFC based code (using CString)? char szTime[65], szDate[65]; time_t t = time(0); struct tm* tm = localtime(&t); strftime(szDate, 64, "%Y%m%d", tm); strftime(szTime, 64, "%H%M%S", tm); CString strTime, strDate; Thanks CTime Time = CTime::GetCurrentTime(); CString strDate = Time.Format("%Y%m%d"); CString strTime = Time.Format("%H%M%S"); AliR. "markww" <markww@gmail.com> wrote in message news:1156883820.948360.39250@m79g200...

I am unable to open links
I am unable to open links in my received messages I keep getting a message up 'this operation has been canceled due to restrictions on this computer please contact administrator' I have checked my security setting and they seem ok, please help!!! This is a problem with IE, its not an Outlook error. You need to reset your internet settings in IE's Tools, Internet Options, Advanced tab. (Or Control panel, Internet options, Advanced tab). See http://www.slipstick.com/problems/link_restrict.htm for the latest information. -- Diane Poremsky [MVP - Outlook] Outlook T...

Pivot Tables #9
Ello I have a list like below Ref Client Name Team TeamMat 1 John 1 Ia 2 Steve 1 Ima 3 Andres 2 Jiv 4 Micel 1 Ima 5 Miquel 2 Jiv I wante to create pivot table to count the unique number of people in team, above team 1 has 2, team 2 has 1 Cant seem to do it with pivot table, is there way or create different type of table useing formulae Thanks for hel Tibow Hi Tibow b...

Excel Automation using in VC 2005
Hi all, I am doing excel automation using MFC in VC 2005. It is just a simple program to just open an excel sheet nothing more than that. I have followed steps describerd in this link: http://support.microsoft.com/kb/308407 But when i build the project it is giving following errors, Can any body tell why it is happening like this..? Errors: error C2371: 'FontPtr' : redefinition; different basic types error C2786: 'BOOL (__stdcall *)(HDC,int,int,int,int)' : invalid operand for __uuidof error C2923: '_com_IIID' : 'Rectangle' is not a valid template type arg...

How to use C# DLL in MFC
Hi all, I developed one C# DLL. now i want to use that DLL to my MFC application created using vc++. Can any one help me how to load those DLL's.... Thanks in advance, SaranG SaranG(Saravanan) wrote: > Hi all, > I developed one C# DLL. now i want to use that DLL to my MFC > application created using vc++. Can any one help me how to load those > DLL's.... > > > Thanks in advance, > SaranG > > I think you could do that through COM interop. Regards, F. Firstly, this is the wrong newsgroup for this question...anyways... you can ...

How do I get certificates to use to send from email addresses???
Everything seemed to go well in setting up email addresses in outlook. They tested fine and I have no problem receiving messages in outlook. The problem comes when I try to send messages .... and I've tried sending from outlook using each and every email address I've set up. This is the message I get: "Microsoft Outlook could not sign or encrypt this message because you have no certificates which can be used to send from the email address mpenza17@verizon.com." I've tried going to sites and downloading certificates. They don't seem to appear in outlook??? A...