Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
sjc sjc is offline
external usenet poster
 
Posts: 1
Default Ole Links (C++)


I don't know if this is the proper forum for asking a C++ Excel
programming question, but here goes.

My application has an _Application, _Workbook, and Workbooks classes
all derived from COleDispatchDriver that were added from Excel's type
library. The two methods I'm interested in using right now a

void ChangeLink(LPCTSTR Name, LPCTSTR NewName, long Type);
VARIANT LinkSources(const VARIANT& Type);

That are declared in the _Workbook class. I'd like to iterate through
all the client links Excel is holding onto and change the filename
they're pointing to, however I can't find any good documentation or
samples on how to use these or any other methods from a C++
perspective. Could anyone direct me to such documentation or provide
some samples?


--
sjc
------------------------------------------------------------------------
sjc's Profile: http://www.excelforum.com/member.php...o&userid=32001
View this thread: http://www.excelforum.com/showthread...hreadid=517354

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Ole Links (C++)

sjc,
The Excel VBA Help has examples of both of these, in VB of course, but
should be relatively straight forward to translate into C++ for someone who
knows that beast.

NickHK

"sjc" wrote in message
...

I don't know if this is the proper forum for asking a C++ Excel
programming question, but here goes.

My application has an _Application, _Workbook, and Workbooks classes
all derived from COleDispatchDriver that were added from Excel's type
library. The two methods I'm interested in using right now a

void ChangeLink(LPCTSTR Name, LPCTSTR NewName, long Type);
VARIANT LinkSources(const VARIANT& Type);

That are declared in the _Workbook class. I'd like to iterate through
all the client links Excel is holding onto and change the filename
they're pointing to, however I can't find any good documentation or
samples on how to use these or any other methods from a C++
perspective. Could anyone direct me to such documentation or provide
some samples?


--
sjc
------------------------------------------------------------------------
sjc's Profile:

http://www.excelforum.com/member.php...o&userid=32001
View this thread: http://www.excelforum.com/showthread...hreadid=517354



  #3   Report Post  
Posted to microsoft.public.excel.programming
sjc sjc is offline
external usenet poster
 
Posts: 1
Default Ole Links (C++)


I've seen samples in VB, like this:


Code
-------------------

Sub ListLinks()
Dim aLinks As Variant
aLinks = ActiveWorkbook.LinkSources(xlExcelLinks)
If Not IsEmpty(aLinks) Then
Sheets.Add
For i = 1 To UBound(aLinks)
Cells(i, 1).Value = aLinks(i)
Next i
End If
End Sub

-------------------


In C++, the parameter to LinkSources is a "const VARIANT&". Well wha
fields in the variant should be populated? And where is xlExcelLink
defined in my case? There's no good documentation for that

--
sj
-----------------------------------------------------------------------
sjc's Profile: http://www.excelforum.com/member.php...fo&userid=3200
View this thread: http://www.excelforum.com/showthread.php?threadid=51735

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Ole Links (C++)

sjc,
LinkSources returns an array of strings or Empty.
xlExcelLinks is defined in Excel as a member of the XlLink enum:
Enum XlLink
xlExcelLinks = 1
xlOLELinks = 2
xlPublishers = 5
xlSubscribers = 6
End Enum

NickHK


"sjc" wrote in message
...

I've seen samples in VB, like this:


Code:
--------------------

Sub ListLinks()
Dim aLinks As Variant
aLinks = ActiveWorkbook.LinkSources(xlExcelLinks)
If Not IsEmpty(aLinks) Then
Sheets.Add
For i = 1 To UBound(aLinks)
Cells(i, 1).Value = aLinks(i)
Next i
End If
End Sub

--------------------


In C++, the parameter to LinkSources is a "const VARIANT&". Well what
fields in the variant should be populated? And where is xlExcelLinks
defined in my case? There's no good documentation for that.


--
sjc
------------------------------------------------------------------------
sjc's Profile:

http://www.excelforum.com/member.php...o&userid=32001
View this thread: http://www.excelforum.com/showthread...hreadid=517354



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Slow opening links between workbooks with links created in 2003 Russell Excel Discussion (Misc queries) 0 December 14th 09 02:59 PM
Update links box gives Continue or Edit Links dialog KarenF Excel Discussion (Misc queries) 0 May 18th 07 01:17 PM
Edit Links: Changing links on a protected worksheet Halibut68 Excel Discussion (Misc queries) 0 April 28th 06 11:03 AM
EXCEL - LINKS cannot easily get list of all links & names in book Tuba Joe Excel Worksheet Functions 1 September 29th 05 10:33 PM
can't update links...can't find links GJR3599 Excel Discussion (Misc queries) 1 April 4th 05 04:56 PM


All times are GMT +1. The time now is 04:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"