VBA Save not working - Saving without format

Sepop

New Member
Joined
Jun 30, 2014
Messages
22
Hi all!

I have a macro that saves a file on the same location the original file was but with a different name. I run the macro and it works fine (and the same with other team members).

When I share this file with some folks from China they run the macro and it seems that it doesnt work. The fiel saves with the correct name (which makes me think that the macro run correctly, since the definition of the name is at the end of the code), but it saves without format (see screenshot on how the file looks on the saved folder).

This is what I used to save the file (please note that the entire code is not shared since it is very long and the definition of the variables has not been included):
VBA Code:
Sub Save file
'Save file
    ActvWBPath = ActiveWorkbook.Path & "\"
    FileNameSv = "Demand File " & QToSave & " - " & YearToSave & "." & MonthToSave & "." & DayToSave
    ActiveWorkbook.SaveAs Filename:= _
        ActvWBPath & FileNameSv _
        , FileFormat:=xlExcel12, CreateBackup:=False
End Sub

Screenshot on how the file looks on the saved folder (as an 8 File - not sure what this is...):
1667919053115.png

Any idea why we migh be having this issue?

I am sorry I cannot share the file with the entire code due to confidentiality reasons.

Thanks a lot!
 

Attachments

  • 1667919045173.png
    1667919045173.png
    4.3 KB · Views: 11
  • 1667919098375.png
    1667919098375.png
    4.3 KB · Views: 12

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I think I saw something like this before a long time ago. I might be a little fuzzy on the details, but I think it is something along the following lines.

Basically, I think there is a Windows setting to hide/not hide file extensions (can be seen in File Explorer).
Since your procedure is NOT explicitly setting the file extension (no "xlsx" on the end), I think it you have that setting to hide it shown, it may not automatically add the file extension.
But since your file name has periods in it (not the best practice, I would advise using a different character, like an underscore), it ends with ".8". So it thinks that "8" is the file extension.

I would recommend doing the following:
- asking them to check if their default setting are hiding file extensions (can be seen in File Explorer), and if they are hidden, change that setting to show them (see here: How to turn on hidden filename extensions in Windows | AutoCAD | Autodesk Knowledge Network)
- update your code to explicitly add the ".xlsx" file extension to the file name
- maybe replace the periods you are adding to the file name with underscores
 
Upvote 0
Solution
I think I saw something like this before a long time ago. I might be a little fuzzy on the details, but I think it is something along the following lines.

Basically, I think there is a Windows setting to hide/not hide file extensions (can be seen in File Explorer).
Since your procedure is NOT explicitly setting the file extension (no "xlsx" on the end), I think it you have that setting to hide it shown, it may not automatically add the file extension.
But since your file name has periods in it (not the best practice, I would advise using a different character, like an underscore), it ends with ".8". So it thinks that "8" is the file extension.

I would recommend doing the following:
- asking them to check if their default setting are hiding file extensions (can be seen in File Explorer), and if they are hidden, change that setting to show them (see here: How to turn on hidden filename extensions in Windows | AutoCAD | Autodesk Knowledge Network)
- update your code to explicitly add the ".xlsx" file extension to the file name
- maybe replace the periods you are adding to the file name with underscores
This worked perfectly! you were right on every part :)

Thanks a lot for the help!
Sebastian
 
Upvote 0
You are welcome.
Glad I was able to help!
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,164
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top