Hi,
I am new to the VBA world and looking for an way to use your example but not clear on how I can go about it.
Here is a senario that I am trying:
1. From Excel, prompt if user would like to attach itinerary.
2. If yes, open file explorer then select attachment.
3. Attach that file to outlook e-mail.
Step 2 is the challenge as I am not familiar with use of ObjShell.
Thanks
dch wrote:
Adapted this from googling aroundfunction setFolder (strTarget) Const
15-Aug-07
Adapted this from googling around
function setFolder (strTarget)
Const Window_Handle = 0
Const Show_EditBox = &H0010
Const Validation = &H0020
Const Desktop = 0
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder( Window_Handle, "Please select a
folder", Show_EditBox + Validation, Desktop)
If objFolder Is Nothing Then
else
Item.UserProperties("Service Kit") = objFolder.Self.Path
setFolder = -1
End if
Set objFolder = Nothing
Set objShell = Nothing
end function
sub displayFolder (strTarget)
Const Window_Handle = 0
Const Show_EditBox = &H0010
Const Validation = &H0020
Const Desktop = 0
Set objShell = CreateObject("Shell.Application")
If isNull(Item.UserProperties("Service Kit")) = False Then objShell.Explore
Eval(chr(34) & Item.UserProperties("Service Kit") & chr(34))
Set objShell = Nothing
end sub
:
Previous Posts In This Thread:
Display File Explorer from VBA/VBScript
I'd like to be able to open the File Explorer to a specific folder using VBA
and/or VBScript. How would I go about coding this? I'm thinking that
CreateObject is going to come into play, but have no idea as to the class of
object to create.
Re: Display File Explorer from VBA/VBScript
This works for me:
Shell "explorer C:\windows"
Adapted this from googling aroundfunction setFolder (strTarget) Const
Adapted this from googling around
function setFolder (strTarget)
Const Window_Handle = 0
Const Show_EditBox = &H0010
Const Validation = &H0020
Const Desktop = 0
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder( Window_Handle, "Please select a
folder", Show_EditBox + Validation, Desktop)
If objFolder Is Nothing Then
else
Item.UserProperties("Service Kit") = objFolder.Self.Path
setFolder = -1
End if
Set objFolder = Nothing
Set objShell = Nothing
end function
sub displayFolder (strTarget)
Const Window_Handle = 0
Const Show_EditBox = &H0010
Const Validation = &H0020
Const Desktop = 0
Set objShell = CreateObject("Shell.Application")
If isNull(Item.UserProperties("Service Kit")) = False Then objShell.Explore
Eval(chr(34) & Item.UserProperties("Service Kit") & chr(34))
Set objShell = Nothing
end sub
:
Submitted via EggHeadCafe - Software Developer Portal of Choice
Build a Cross-Browser ASP.NET CSS-Only Menu UserControl
http://www.eggheadcafe.com/tutorial...ce-d17d1b482676/build-a-crossbrowser-asp.aspx