DDE link update for stock quotes

H

hollings316

Hello,

I have a spreadsheet that uses DDE links to retrieve stock quotes. I
have set all of the links to use auto updating. For some unknown
reason, 1 or more DDE link will be reset to manual updating. (I
haven't been able to determine what causes this.)

I have some VBA code to get a list of the DDE links in the workbook,
and determine which one(s) are set to manual. I use the following:

Public Sub TestLinks()
Dim aLinks As Variant
Dim i As Integer

On Error GoTo ErrorHandler

aLinks = ActiveWorkbook.LinkSources(xlOLELinks)
If Not IsEmpty(aLinks) Then
For i = 1 To UBound(aLinks)
If ActiveWorkbook.LinkInfo(aLinks(i), xlUpdateState,
xlLinkInfoOLELinks) = 2 Then
Debug.Print "manual link:" & aLinks(i)
End If
Next i
End If

ExitProcedure:
On Error Resume Next

Exit Sub
ErrorHandler:
MsgBox Err.Description, vbCritical + vbOKOnly
Resume ExitProcedure
End Sub

I'm aware that I can go to the Edit->Links menu, and change the link
update there. My question is this: is there a way to
programmatically change a link from manual update to auto update?
(Setting the LinkInfo property to 2 doesn't seem to work.)

Thanks,

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top