PDA

View Full Version : VBA - Opening Windows folder ?



NessPJ
07-11-2014, 01:05 AM
Hi there,

I'm using the following VBA to try and open a folder in Outlook. The code works in Excel but its not working for me in Outlook. Here's the code:



Sub OpenFolderTest()
Dim Foldername As String
Foldername = "C:\Temp\"
Shell "explorer.exe" & " " & """ & Foldername & """, vbNormalFocus


Does anyone know how to make this work perhaps?

westconn1
07-11-2014, 03:42 AM
should be
Shell "explorer.exe" & " " & """" & Foldername & """", vbNormalFocus

or

Shell "explorer.exe" & " """ & Foldername & """", vbNormalFocus

NessPJ
07-11-2014, 04:10 AM
Thanks for the tip.

I also found out that all/any macro's had to be allowed through the Trust Center settings in Outlook. Its working now. :)