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

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

offthelip

Well-known Member
Joined
Dec 23, 2017
Messages
2,166
Office Version
  1. 2010
Platform
  1. Windows
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:

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
37,826
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Welcome to the forum.

Which version, and build, of Excel are you using?
 

HeinzMan

New Member
Joined
Feb 15, 2018
Messages
4
Offthelip - tried your solution still the same result.
RoryA - Microsoft Excel 2013 (15.0.5007.1000) MSO (15.0.5007.1000) 64 Bit
 

offthelip

Well-known Member
Joined
Dec 23, 2017
Messages
2,166
Office Version
  1. 2010
Platform
  1. Windows

ADVERTISEMENT

Have you tried adding the correct extension to the filename?
"K:\Projektid\2018\Uus kaust_New Folder\_2 Joonised_drawings\WorkNo"
.xls? .xlsm? .txt?
 

HeinzMan

New Member
Joined
Feb 15, 2018
Messages
4
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 ""
 

offthelip

Well-known Member
Joined
Dec 23, 2017
Messages
2,166
Office Version
  1. 2010
Platform
  1. Windows
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:

HeinzMan

New Member
Joined
Feb 15, 2018
Messages
4
Hey
Thank you for you suggestion, but still no luck
What i tried:
Code:
Address:="http://www.wrc.com/en"
 

Forum statistics

Threads
1,148,293
Messages
5,745,931
Members
423,985
Latest member
sayed manzar

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
Top