VBA code not working : ActiveWorkbook.FollowHyperlink Address:=FileName

esmarques

New Member
Joined
Oct 27, 2020
Messages
20
Office Version
  1. 365
Platform
  1. MacOS
Hello,
Would anyone know how to make this bit of the code work ?
I use a Mac and this is to save a file as pdf in a folder in google drive...

When I run the code, there is an error message "Run-time error '-2147221014(800401es): Cannot open the specified file." And the debug highlights "ActiveWorkbook.FollowHyperlink Address:=FileName"
Any help ?

Thank you

WkP = "/Volumes/GoogleDrive/My Drive/Nas My Cloud/Global Grooves/Gigs_Commercial_Projects _Events/Costumes and Making/Packing Lists/"
FileName = Range(NameAdd) & "_" & Format(Range(DateAdd), "YYMMDD") & ".pdf"
FileName = WkP & Application.PathSeparator & FileName
ActiveSheet.PageSetup.PrintArea = Rng.Address
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FileName _
, Quality:=xlQualityStandard, IncludeDocProperties:=True

ActiveWorkbook.FollowHyperlink Address:=FileName
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Why are you defining the FileName variable twice?
VBA Code:
FileName = Range(NameAdd) & "_" & Format(Range(DateAdd), "YYMMDD") & ".pdf"
FileName = WkP & Application.PathSeparator & FileName

If you put in a debug.print line does the file path look correct?

Rich (BB code):
WkP = "/Volumes/GoogleDrive/My Drive/Nas My Cloud/Global Grooves/Gigs_Commercial_Projects _Events/Costumes and Making/Packing Lists/"
FileName = Range(NameAdd) & "_" & Format(Range(DateAdd), "YYMMDD") & ".pdf"
FileName = WkP & Application.PathSeparator & FileName
DeBug.Print FileName
ActiveSheet.PageSetup.PrintArea = Rng.Address
 
Upvote 0
Why are you defining the FileName variable twice?
VBA Code:
FileName = Range(NameAdd) & "_" & Format(Range(DateAdd), "YYMMDD") & ".pdf"
FileName = WkP & Application.PathSeparator & FileName

If you put in a debug.print line does the file path look correct?

Rich (BB code):
WkP = "/Volumes/GoogleDrive/My Drive/Nas My Cloud/Global Grooves/Gigs_Commercial_Projects _Events/Costumes and Making/Packing Lists/"
FileName = Range(NameAdd) & "_" & Format(Range(DateAdd), "YYMMDD") & ".pdf"
FileName = WkP & Application.PathSeparator & FileName
DeBug.Print FileName
ActiveSheet.PageSetup.PrintArea = Rng.Address
Hello,

Thanks for the reply.
I am not really good with codes, this one I have was sugested a while ago by someone else here when I had trouble saving the file into Google drive....

When I added the Debug.print File Name, nothing happened, apart from exactly the same as it was before.....
 
Upvote 0
One other thing that I just noticed is that the first error message that appears is:
"There was a problem connecting to the server "127.0.0.1". This file server will not allow any additional users to log on. Try to connect again later."
I am the administrator and logged in as such....

Thank you
 
Upvote 0
The Debug.Print will appear in the Immediate window (if you can't see the Immediate Window press Ctrl + G, you might need to drag it to expand the window).
Nothing we can do about the server error that I can think of at the moment
 
Upvote 0
The Debug.Print will appear in the Immediate window (if you can't see the Immediate Window press Ctrl + G, you might need to drag it to expand the window).
Nothing we can do about the server error that I can think of at the moment
Hello, Sorry but the Debug.Print still don't do anything... not sure if makes a different being on a Mac ?
 
Upvote 0
Hello, Sorry but the Debug.Print still don't do anything... not sure if makes a different being on a Mac ?
What do you mean it does nothing? You can't see the window? the file path for FileName doesn't appear in the window so you can check that the path looks correct?
 
Upvote 0

Forum statistics

Threads
1,215,161
Messages
6,123,378
Members
449,097
Latest member
Jabe

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