save with question mark in name

abenitez77

Registered User.
Local time
Today, 11:07
Joined
Apr 29, 2010
Messages
141
I have a process that runs thru thousands of files and in the end of several steps it saves the file to the z drive. I ran into a problem when it tried to save a file that has a ? in the name. I converted that to chinese letters.

Code:
ProWkBk = "Vango loveseat ????FR091 20171205.xls"

ActiveWorkbook.SaveAs "Z:" & ProWkBk
When I check z drive the file it created was :

Vango loveseat 产品资料FR091 20171205.xls

How did this happen and how do I prevent this?
 
Did you intend to change ? to a specific Chinese character? If so, which?

This would appear to be similar to the database corruption issue with 'Chinese' characters that has been occurring regularly in this forum recently
For example, see https://www.access-programmers.co.uk/forums/showthread.php?t=299217

Can you open the Excel file or has your loveseat got corrupted too? :rolleyes
Perhaps those are illegal characters for a file name as are ?????

I suggest changing '?' to something permissible but unusual
e.g. '£' or '!' or '#' or just omit that part of the file name
 
The original file has ? in the name. I am only making a copy of the original and need the name to be the same. I can open the file and it has chinese letters in the spreadsheet.
 
The question marks would be placeholders for the unprintable 'Chinese' characters that actually form the original filename that is coming from a system with a different character set from yours.
 
Question mark "?" is a wildcard character in Access (like "*"). Best to keep it out of your strings.

You could replace the question marks with another, neutral, character and see if that resolves it.
 
Last edited:
"?" is also used by different operating systems as a wild card and is not valid in file names for all systems. Is you "Z" drive on a file server? If so, is it valid in file names for your server?
 

Users who are viewing this thread

Back
Top Bottom