Help! Excel VBA "Dir" statement converting ≤ and ≥ to = !!!

pmb67

New Member
Joined
Sep 30, 2013
Messages
1
Hi all,
Am well and truly stumped by this one... I'm writing a file backup utility which depends on reading the contents of a bunch of folders and working out which files to copy to a backup location. Trouble is, a couple of files have "greater than / equal to" and "less than / equal to" symbols in their names, i.e. ≤ and ≥ ; when I cycle through the directory file by file using the loop below, the Dir statement returns a different name, e.g the result (strDirCheck) for the filename "ABC≤123.txt" is "ABC=123.txt", so when I then try to get the save date/time and size, I get an error:

strDirCheck = Dir(strProdDir, vbDirectory)
Do While strDirCheck <> ""
If strDirCheck <> "." And strDirCheck <> ".." Then
intFileCount = intFileCount + 1
With wksFiles.Range(strListHomeRange)
.Offset(intFileCount, 0).Value = strProdName
.Offset(intFileCount, 1).Value = strDirCheck
.Offset(intFileCount, 3).Value = FileDateTime(strProdDir & strDirCheck)
.Offset(intFileCount, 4).Value = FileLen(strProdDir & strDirCheck)
End With
End If
strDirCheck = Dir
Loop

If anyone else has seen this and has a solution, please let me know! In the meantime I'm going to see if there's a workaround...

Thanks!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
If those are Unicode characters in the filename, Dir can't handle it. You'll need to use Scripting.FileSystemObject.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,192
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top