Follow Hyperlink Macro only works in Pause/Break Mode

jdutle

New member
Joined
Dec 9, 2015
Messages
8
Reaction score
0
Points
0
Hello.
As part of a macro I am working on, I would like Excel to follow/open a hyperlink to another Excel workbook.

When I CLICK ON THE HYPERLINK in the workbook, I get the warning about making sure the file is from a trustworthy source, I hit ok, and the workbook file opens just fine.

But when I RUN THE MACRO, I get the warning about making sure the file is from a trustworthy source, I hit ok, but then the hourglass comes up, Excel pauses for a moment and then nothing happens.

If I change the hyperlink to be a Word Doc, then when I RUN THE MACRO it opens just fine. Word starts and the document opens.

I did find a clue I think. I accidentally hit the pause/break button when testing the macro. I then hit resume and ran the macro again and it worked as it should?!? But it only works in the VB window. I tried mapping the macro to a button in the workbook after things were working, but when I clicked it to run the macro things behaved as before. The file wouldn’t open.

Why does it work after the pause/break button has been pressed, and only in the VB window?
Is there a way I can recreate that effect of pause/break in the macro as it runs so that it always works as it should. Thanks for any and all help!

The code I am using to follow the hyperlink is below:

Code:
Sub HLTest()
'
' HLTest Macro
'
 
'
    Range("B4").Select
    Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
  End Sub
 
I came to this forum looking for help. Telling me to read a book that may or may not answer the question I have is not helpful. I am trying to learn VBA, but I do not have the luxury of time for this specific question, thats why I am asking it here, hoping that someone can help me with the answer.
 
Back
Top