VBA - open a folder from within Excel

rupertsland

New Member
Joined
Sep 7, 2010
Messages
2
Hello.

I'm trying to generate a VBA procedure in Excel 2003 that would let me open a folder window by clicking on a button in an Excel worksheet.

Here's the code I wrote:

'---------------------------------------------------------------
Public Sub OpenFolder() 'open folder on network

'declare variable:
Dim strFilePath As String

strFilePathCodes = Range("filepath").Value
ActiveWorkbook.Filename = strFilePath

End Sub
'------------------------------------------------------


"Range" is a range name "filepath" that refers to a cell where I store the path to the folder I want to open: D:\Test\

The statement ActiveWorkbook.Filename is obviously wrong, but I can't seem to find the correct statement to actually open the folder. Any suggestions or code that would help me solve my problem?

Sincerely,
Rupertsland
 

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
Hi Gary.

Thank you for your help. I tried your solution and it works great. :)

By "Open Folder", I was referring to a folder window.


Cheers,
Rupertsland
 
Upvote 0

Forum statistics

Threads
1,215,437
Messages
6,124,871
Members
449,192
Latest member
MoonDancer

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