Vba code to open folder opens my computer instead

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Hi,
I am trying to open a folder called DR COPY INVOICES but when i run the code below it opens My Computer.
Can you see an issue with it or if need be advise another code
Thanks

Rich (BB code):
Private Sub OpenPdf_Click()
Dim Foldername As String
Foldername = "\\server\DR COPY INVOICES\"

Shell "C:\WINDOWS\explorer.exe """ & DR COPY INVOICES & "", vbNormalFocus
End Sub
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
If the path is valid then it should work. Try Shell "C:\WINDOWS\explorer.exe " & Foldername, vbNormalFocus
 
Upvote 0
Hi,
After a while it did open My documents.

This however did work shown below.

Rich (BB code):
Private Sub OpenPdf_Click()
Dim strFolder As String
strFolder = "C:\Users\Ian\Desktop\REMOTES ETC\DR\DR COPY INVOICES\"
ActiveWorkbook.FollowHyperlink Address:=strFolder, NewWindow:=True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,223
Messages
6,123,714
Members
449,118
Latest member
MichealRed

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