Follow Hyperlink Macro only works in Pause/Break Mode

jdutle

New Member
Joined
Dec 8, 2015
Messages
17
Hello.</SPAN>
As part of a macro I am working on, I would like Excel to follow/open a hyperlink to another Excel workbook.</SPAN>

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.</SPAN>

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.</SPAN>

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.</SPAN>

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.</SPAN>

Why does it work after the pause/break button has been pressed, and only in the VB window?</SPAN>
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!</SPAN>

The code I am using to follow the hyperlink is below:</SPAN>

Code:
Sub HLTest()</SPAN>
'</SPAN>
' HLTest Macro</SPAN>
'</SPAN>
 
'</SPAN>
    Range("B4").Select</SPAN>
    Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True</SPAN>
  End Sub</SPAN>
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
I'm not sure about why it's doing that, but could you try opening the workbook with a line such as:

Workbooks.Open "C:\Documents\myfile.xls"
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,224
Members
452,620
Latest member
dsubash

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top