save with question mark in name (1 Viewer)

abenitez77

Registered User.
Local time
Today, 16:16
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?
 

isladogs

MVP / VIP
Local time
Today, 21:16
Joined
Jan 14, 2017
Messages
18,217
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
 

abenitez77

Registered User.
Local time
Today, 16:16
Joined
Apr 29, 2010
Messages
141
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.
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 06:16
Joined
Jan 20, 2009
Messages
12,852
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.
 

Orthodox Dave

Home Developer
Local time
Today, 21:16
Joined
Apr 13, 2017
Messages
218
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:

Mark_

Longboard on the internet
Local time
Today, 13:16
Joined
Sep 12, 2017
Messages
2,111
"?" 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

Top Bottom