For readability, I would have
Code:
Unload OpenFile
Exit Sub ' Makes the intent more clear (to me, anyway)
ErrorHandler: ' Error-handling routine.
Dim StrErr As String
StrErr = Err.Number & " - " & Err.Description
If Err = 364 Then ' This is a bit unnec., as you are going to be leaving the sub immediately anyway.
Exit Sub
End If
End Sub
Since you are just opening the .csv in Excel, preformatting isn't actually an option.
What I was thinking is that you would open Excel, open the file in
VB, read the file (adjusting the values as nec.), then write the values into the open, new workbook.
Perhaps Excel keeps the original values that generate the cell display, and you could use
vb (or VBA within Excel) to traipse over the whole range of what was brought in, and if it finds the sort of format that you described initially, prefix a single quote to the beginning of it. (If you know exactly where these values come inâwhich columnâyou could process juset that column.)