LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ray Ray is offline
external usenet poster
 
Posts: 267
Default ™*Modify my code: Need to qualify FolderDialog selection

Hi -

The code below is used by several procedures within a Tool I'm
currently developing. The code works well, but during End-User
testing, a 'hole' has been discovered -- the user can select a folder
containing old data, which will continue to work because these old
files are the proper format. So, I'd like to add a 'quality check' of
sorts -- one thought would be to check the 'modified date' on the
first workbook in the folder and to throw a msgbox if it's more than
180 days older than the current date. it's only necessary to check
one workbook, as other workbooks in the folder will be from the same
month.

I'm not sure what the coding to do this looks like ...

Can you help? I've indicated below where I think this quality check
should go, but am certainly open to other ideas ..

Thanks very much for your time!

Regards, Ray


Sub PickPath()

Dim Flags As Long, DoCenter As Boolean, Preset As String, Base As
String

Flags = BIF_RETURNONLYFSDIRS
Flags = Flags + BIF_NEWDIALOGSTYLE

Preset = Sheet6.Range("F17").Value

'If Len(Preset) 0 Then
If Len(Dir(Preset)) = 0 Then
Base = Preset
'End If
Else
Base = CurDir
End If

RetStr = GetDirectory(Base, Flags, DoCenter, "Please select a
location to import from ...")
If RetStr = "" Then
MsgBox "No path selected ... update cancelled!"
Exit Sub
End If

' Quality-check code here
' If modified-date < ( current-date - 180)
' Then msgbox "data too old"
' exit sub
' End if
' End of Quality-Check Code

Sheet6.Range("F17").Value = RetStr

End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I modify my code to offset the defined range and repeat theprocedure instead of duplicating my code? [email protected] Excel Programming 4 May 29th 09 10:13 PM
Modify each cell in selection Clayman Excel Programming 3 August 11th 08 08:51 PM
VBA - Modify data in selection Clayman Excel Programming 3 July 25th 08 12:56 PM
Modify existing code to dynamic code Ixtreme Excel Programming 5 August 31st 07 11:42 AM
Modify a calculated field formula depending upon selection of pagefield Tewari Excel Discussion (Misc queries) 0 April 10th 07 01:35 PM


All times are GMT +1. The time now is 03:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"