Using Hyperlinks in VBA

M

MichaelA

Hello All,

I am looking to use a hyperlink where a particular Excel template
resides. I am using "Application.FollowHyperlink" as I am not using a
hyperlink associated with the project. It works, however there are a
few messages that come up, and the workbooks are not activated.

1. Does anyone know if there is a way to suppress the application
messages that come through when opening the application?

2. I need to activate the workbook so it can be used. Would anyone
know how I can activate the workbook once it has been opened from the
hyperlink?

I appreciate your assistance.

Regards
Michael Andersen
 
J

Jack Dahlgren

I'd add a reference to the Excel object library. Then open an instance of
Excel. Using excel, pass the URL to the "open" method. Here is an example
below:

If xlApp Is Nothing Then
'Start new instance
Set xlApp = CreateObject("Excel.Application")
If xlApp Is Nothing Then
MsgBox "Can't Find Excel, please try again.", vbCritical
End 'Stop, can't proceed without Excel
End If

Else
Set xlR = Nothing
Set xlApp = Nothing
Set xlBook = Nothing
Set xlApp = CreateObject("Excel.Application")
If xlApp Is Nothing Then
MsgBox "Can't Find Excel, please try again.", vbCritical
End 'Stop, can't proceed without Excel
End If

End If

xlApp.workbooks.Open("put your url here")


Jack Dahlgren
 
M

MichaelA

I'd add a reference to the Excel object library. Then open an instance of
Excel. Using excel, pass the URL to the "open" method. Here is an example
below:

If xlApp Is Nothing Then
'Start new instance
Set xlApp = CreateObject("Excel.Application")
If xlApp Is Nothing Then
MsgBox "Can't Find Excel, please try again.", vbCritical
End 'Stop, can't proceed without Excel
End If

Else
Set xlR = Nothing
Set xlApp = Nothing
Set xlBook = Nothing
Set xlApp = CreateObject("Excel.Application")
If xlApp Is Nothing Then
MsgBox "Can't Find Excel, please try again.", vbCritical
End 'Stop, can't proceed without Excel
End If

End If

xlApp.workbooks.Open("put your url here")

Jack Dahlgren










- Show quoted text -

That last line is the critical one. Absoluely perfect!

Thank you Jack!


Michael A
 

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