View Single Post
 
Old 01-14-2015, 02:07 PM
ptmuldoon ptmuldoon is offline Windows 7 64bit Office 2013
Advanced Beginner
 
Join Date: Sep 2014
Posts: 93
ptmuldoon is on a distinguished road
Default

My word document is currently linking to 63 separate tables in Excel. All of those links are already in the document, and the user can simply press F9 or right click to update the table.

But there will be (and has happened already) times when the user mistakenly deletes the charts from table. And they do have the 'know how' on creating/adding the paste-link table back into the document.

So, the ContentControl should provide a listing of all of the available charts. And the user can then insert a chart back into the document. It does not have to be specifically within the content control.

I think may be better to have it added outside the content control actually in case the user needs to edit/change the link source?

I've created a listing in excel (attached), and I can add the link code in with this basic code for a single link. But creating a full listing is still beyond me.

Note, the 'links' in the excel file all used names ranges to where the actual tables are in the excel file.

Code:
'  Additional code above using late binding..
' 
Set objXL = CreateObject("Excel.Application")   'set reference to the Excel Object
    Set objWkb = objXL.Workbooks.Open(FileName:=prmFileName)  'set reference to the Excel workbook
    Set objSht = objWkb.Sheets(prmSheetName)  'set reference to the Excel Sheet
       
    With objSht
        ChartLink = .Range("C2")
        MsgBox ChartLink
    End With

    Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:=ChartLink, PreserveFormatting:=False
Attached Files
File Type: xlsm TestFileLinks.xlsm (17.2 KB, 13 views)
Reply With Quote