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 Chriss Miller 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
Joined
Jun 12, 2013
Messages
28
Location
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,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
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,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
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