View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
cereldine[_24_] cereldine[_24_] is offline
external usenet poster
 
Posts: 1
Default button that opens open dialogs but saves path to sheet


Thanks for the explanation, it helps to find out what things are reall
doing for future reference. Ive used the code in the following way an
for something so simple it works perfectly

Dim pathChange As Range
Dim pathandfilename As Variant

Public Sub NQAJ_change()
Range("C15").Select
Set pathChange = ActiveCell
GetPath
End Sub

Sub GetPath()
pathandfilename = Application.GetOpenFilename

If pathandfilename = False Then
MsgBox "User quits the dialog"
Else
' MsgBox "The path is: " & pathandfilename
pathChange = pathandfilename
End If

End Sub

This way i can use the getpath procedure from many places.

There may be one last improvement, i have bout +12 different exce
sheets all located in one folder, my function saves the foldername as
string then the loop uses the offset(1,0) to loop through these files i
turn(uses two strings - foldername &\& File_name). I'm thinking in thi
case it is only really neccasery to update the folder path not th
individual files themselves(they will always have same name just b
located in different folders for audit trail). Is it possible to tri
the getopenfilename to only retrieve the folder pathway? If not don'
worry this has been great help already, thank

--
cereldin
-----------------------------------------------------------------------
cereldine's Profile: http://www.excelforum.com/member.php...fo&userid=3206
View this thread: http://www.excelforum.com/showthread.php?threadid=53674