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>
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>