hi dudes :D
hi have a problem with the save as macro :D
i created that sub
i retrieve the value of a cell and with that i create a name to pass to the save-as .
the save as has a check to ask if overwrite or not.
everything works fine but i have to localize the sub also for not-english excel..
Public Sub Save_Click()
On Error GoTo ErrorHandler
Dim Filename As String
Dim fileSaveName As String
Dim note As String
Dim overwriteFile As VbMsgBoxResult
Dim TableName As Range
Set TableName = Range("TableName")
Filename = TableName.Value
With Application
.ScreenUpdating = False 'disable screen updating
.EnableEvents = False 'disable events
.Run "protectAndHide"
.ScreenUpdating = True 'disable screen updating
.EnableEvents = True 'disable events
End With
' this opens the Save As window and sets the filename and file type
fileSaveName = Application.GetSaveAsFilename(Filename & ".xls", fileFilter:="Microsoft Excel Workbook (*.xls),*.xls")
If (fileSaveName = False) Then 'User click cancel
Exit Sub
Else 'User click ok
If Len(Dir(fileSaveName, vbNormal)) = 0 Then 'The file not already exists
ActiveWorkbook.SaveAs Filename:=fileSaveName 'Save file
MsgBox "Saved as : " & vbNewLine & fileSaveName
Exit Sub
Else ' The file already exists, Display MessageBox if overwrite
note = "The file already exists!" & vbNewLine & "Do you want to replace " & fileSaveName & " ?"
overwriteFile = MsgBox(note, vbQuestion + vbYesNo, "Overwrite file?")
If overwriteFile = vbNo Then 'No overwrite
Exit Sub
Else 'yes overwrite
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=fileSaveName 'Save file
Application.DisplayAlerts = True
Exit Sub
End If
End If
End If
Exit Sub
ErrorHandler:
MsgBox "Unfortunately, an error has occurred saving the file.", vbOKOnly, "Error"
With Application
.ScreenUpdating = True 'en screen updating
.EnableEvents = True 'en events
End With
Exit Sub
End Sub
the problem is that..
If (fileSaveName = False) Then
Exit Sub
is not working...
so i tried
If (fileSaveName = "False") Then
Exit Sub
it works only for english excels
then i tried
If (fileSaveName = "Falso") Then
Exit Sub
it works only for italian excels ..
i could make a switch to check every "false" word in every language .. but i'm looking for a smarter idea
is there a way to check the "false" word not localized in some language?
please i need your help ^_^
regards and thanks
Jack
Bookmarks