I prefer the following as it takes care of different drives and networks
Private Declare Function SetCurrentDirectoryA Lib _
"kernel32" (ByVal lpPathName As String) As Long
Sub SetUNCPath(sPath As String)
Dim lReturn As Long
lReturn = SetCurrentDirectoryA(sPath)
If lReturn = 0 Then _
MsgBox "Error setting path."
End Sub
Bob Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on
VB macros for Excel
"pkohler " wrote in message
...
I am using a macro to help a user put an image into an excel sheet. I
would like for the user to be able to click on the button and
automatically be browsing the directory that the excel sheet is in, but
if not that then I would like to declair a default variable.
Currently, when you click button it defaults to "My Documents". The
Code Snipit in question is bellow. Any suggestions?
Dim filename As String
filename = Application.GetOpenFilename("Pictures
(*.jpg;*.gif;*.bmp), *.jpgs;*.gif;*.bmp", , "Grab Your Logo", ,
"False")
If filename = "False" Then
Application.ScreenUpdating = True
Call protect
Exit Sub
Else
Thanks
---
Message posted from http://www.ExcelForum.com/