Hi, I'm struggling to concoct some vba to rename some files in a folder. The problem came about because a web portfolio system at work exports files for students with a SQL UUID - meaningless string - instead of the Title. So they have a folder full of files they don't recognise without opening up each one and renaming it, too much esp. when lots of files. I can access the web system table from Access, and I can get the windows folder path (using 'FileDialog) into a text box called txtFolderPath. But the next bit is foxing me. I can get a recordset/query with the UUID and the 'Title' in the same record (along with the UserID of the student), thereby matching the correct 'Title' to the UUID. So I want to: Rename windows file to Recordset.Title where windows file = Recordset.UUID, so I guess the vba is going to have to loop through until each matching record is renamed to 'Title'.
I'm a long way off, but I've started with
Dim strFile As String
Dim strPath As String
strFile = Dir(strPath & "*.*")
strPath = Me.txtFolderPath
then a looping function is needed and i can't figure it out, followed by something like
Name strPath & strFile As strPath & Recordset.Title
But I get no action happening, or loop errors. I've probably tried too many variants to post here, I may just may make it sound more confusing than I already have!
Does anything about this make sense?
I'm a long way off, but I've started with
Dim strFile As String
Dim strPath As String
strFile = Dir(strPath & "*.*")
strPath = Me.txtFolderPath
then a looping function is needed and i can't figure it out, followed by something like
Name strPath & strFile As strPath & Recordset.Title
But I get no action happening, or loop errors. I've probably tried too many variants to post here, I may just may make it sound more confusing than I already have!
Does anything about this make sense?
Last edited: