Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel VBA Links/Connections not showing

Status
Not open for further replies.

BrooksMT

Programmer
Jun 12, 2013
28
US
I'm working with some Excel objects through VBA in Access.

I'm working with a spreadsheet that has 3 connections. I can see them in Data, Edit, Links.

But when I create and Excel object and a workbook object, I can't see the links.

?xlIn.ActiveWorkbook.Connections.Count
0
?xlBookIn.Connections.Count
0

The counts return zero and should be 3.

Other VBA code works fine. I can list the worksheets, return cell values and formulas, so I know the objects work.

Any suggestions appreciated.

Brooks
 
Hi,

But when I create and Excel object and a workbook object, I can't see the links.

That's because you have not CREATED any links in this NEW Application/Workbook!

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
It is not a new workbook. I am opening up and setting links to an existing workbook.

I can see the worksheets and all the cells, just not the links/connections.
 
Post your code

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Running this code from inside Excel does not show any of the 3 links that I can see by going to menu: Data, Edit Links.

Sub ListLinks()

Dim aLinks As Variant
Dim i As Integer

aLinks = ActiveWorkbook.LinkSources(xlOLELinks)

If Not IsEmpty(aLinks) Then
For i = 1 To UBound(aLinks)
MsgBox "Link " & i & ":" & Chr(13) & aLinks(i)
Next i
End If

End Sub

 
I figured it out. Wrong constant. It needed to be:

aLinks = ActiveWorkbook.LinkSources(xlExcelLinks)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top