I am using this piece of code for seperating sheets to single files:
Sub Splitbook()
Dim xPath As String
xPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each xWs In ThisWorkbook.Sheets
xWs.Copy
Application.ActiveWorkbook.SaveAs Filename:=xPath & "\" & xWs.Name & ".xlsx"
Application.ActiveWorkbook.Close False
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
But I get these two errors respectively when I run the code:
and that file ".\VB5052.tmp" is being created at run time. I figured out that this error occurs when my path have non-english characters. So, how to configure VBA in order to support non-english characters?
By the way, I have many different paths and I am doing this seperation most times.
This Path didn't work: "D:\Yeni Klasör" However, when I remove the "ö" character: "D:\Yeni" this works. My sheet names include non-english characters but it is not the error. Just editing the path works.
The solution is just controlling the system locale on windows like that:
In the 5th step, choose the language that you need (i.e. the language that has your character). Otherwise your path will contain some different characters which cause errors at run time.