Excel add hyperLink error

HeinzMan

New Member
Joined
Feb 15, 2018
Messages
4
Hello i tried to enter hyperlink by vba but every time i get Error 1004.

Code i am using:

Code:
ActiveSheet.Range("G" & LastRow2).Parent.Hyperlinks.Add Anchor:=ActiveSheet.Range("G" & LastRow2), Address:=ProjectFolder, TextToDisplay:="Drawings"

Also tried:
Code:
WoBok2.Worksheets("Sheet1").Hyperlinks.Add Anchor:=WoBok2.Worksheets("Sheet1").Range("G" & LastRow2), Address:=ProjectFolder

I tried bunch of different stuff.

ProjectFolder return value of: "K:\Projektid\2018\Uus kaust_New Folder\_2 Joonised_drawings\WorkNo"

What code does is it takes on workbook values open another workbook and gives it some values and also want to give workbook location hyperlink(only thing that does not want to work).

Can anyone suggest what i am doing wrong.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I have just copied this code out of a workbook that I created so I know this works:
Code:
      With Worksheets(monm)    
                        .Hyperlinks.Add Anchor:=.Range(Cells(rown, 8), Cells(rown, 8)), _
                        Address:=newf, _
                        TextToDisplay:=foln
      End With
obviously: monm is a worksheet index, Rown is row number index, Newf is a path to a file ( newfile in my application)
foln is a text string
 
Last edited:
Upvote 0
Welcome to the forum.

Which version, and build, of Excel are you using?
 
Upvote 0
Offthelip - tried your solution still the same result.
RoryA - Microsoft Excel 2013 (15.0.5007.1000) MSO (15.0.5007.1000) 64 Bit
 
Upvote 0
Have you tried adding the correct extension to the filename?
"K:\Projektid\2018\Uus kaust_New Folder\_2 Joonised_drawings\WorkNo"
.xls? .xlsm? .txt?
 
Upvote 0
Hey thank you for your answer

I tried also with full address no success, but my idea was to open containing folder where file is so i cut that address from last ""
 
Upvote 0
The next thing that I would try would be the same file in a local folder and a different file in the server folder to see if it related to the folder or the file. Or even check you can create a link to a different file in your local folder
 
Last edited:
Upvote 0
Hey
Thank you for you suggestion, but still no luck
What i tried:
Code:
Address:="http://www.wrc.com/en"
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,268
Members
448,558
Latest member
aivin

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