Error 1004 - FollowHyperlink

markw1804

New Member
Joined
Nov 19, 2020
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Morning All,
A real strange one that I cant work out, this code has been working without issue from a label click on a userform which opens a hyperlink to an image stored on a shared drive. It just stopped working yesterday.
I am getting the 1004 runtime error - Application defined or object defined error

VBA Code:
Private Sub lblAddDrawing1_Click()
ActiveWorkbook.FollowHyperlink Worksheets("Stock").Range(CurrentRow + 2, 34).Value, NewWindow:=True
End Sub

I have checked the current row is correct and the hyperlink is in column 34
When I click on the hyperlink from the spreadsheet it works no problem. I tried removing and re-adding the hyperlink as well.

Any pointers would be much appreciated,

Mark
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
markw1804

If accessing the hyperlink directly on the spreadsheet works then that narrows the range of possible errors to between the label and the cell containing the hyperlink.

Is the label's macro pointing at this piece of code? If some copying and pasting from somewhere else has been done there may be another label on top of the original one linked to some code somewhere else which may be inaccessible. Try deleting the visible label to see if that reveals another label underneath. Ctrl-Z will reverse the deletion if there isn't a second label.

If the label has been copied maybe it has a different name (like lbl102_click) which has no defined click event.

The part of the code Worksheets("Stock") has no source workbook so the code just has to decide for itself which workbook the sheet "Stock" belongs to (usually the Active workbook). If somehow the workbook that this code is in is not the Active workbook then that would cause problems.
 
Upvote 0
Thank you for responding, I have double checked all your suggestions and as a last resort I recreated a new sheet and userform and getting the same error.
Must be something on the PC.
 
Upvote 0
If clicking on the hyperlink directly on the sheet works then it is highly unlikely to be the PC.

Have you tried setting up a Watch window and examining the values of the various variables in the code? One of them will have an error value, it's just a question of finding which one.
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,539
Members
449,088
Latest member
RandomExceller01

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