VBA: save as Microsoft 5.0 via MACRO

BIGTONE559

Active Member
Joined
Apr 20, 2011
Messages
336
I'm lost as to how to save a spreadsheet as the Microsoft 5.0(95 workbook). I normally use the following to save as CSV files:

ActiveWorkbook.SaveAs Filename:= _
"\\Test\C\TestFolder\" & Range("L2").Value & ".csv", FileFormat:=xlCSV _
, CreateBackup:=False

All help is appreciated.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Try something like this...

ActiveWorkbook.SaveAs Filename:= _
"\\Test\C\TestFolder\" & Range("L2").Value & ".xls", FileFormat:=56
 
Last edited:
Upvote 0
Code:
Sub Save_Test()
If Not IsNumeric(Right(Cells(2, 12), 4)) Then
MsgBox ("blah blah bad")
Else
ActiveWorkbook.SaveAs Filename:= _
"\\Master01\C\Gallo\" & Right(Cells(2, 12), 4) & ".xls", FileFormat:=56
ThisWorkbook.Saved = True
MsgBox ("Blah blah #" & Right(Cells(2, 12), 4) & " has been saved and is now available")
End If
End Sub

I got it to work and it goes thru and saves the file properly. However, when it prompts that a file already exists and if i want to save over it, once i hit cancel or no it throws up an error 400. . . with no text in the error box.

Any ideas of a solution?
 
Upvote 0
What solution are you looking for?
  1. Automatically overwrite without prompting
  2. Prompt to overwrite but not error when canceled
  3. Test if the file already exists and just message it already exists (no Overwrite\Cancel prompt).
 
Upvote 0
What solution are you looking for?
  1. Automatically overwrite without prompting
  2. Prompt to overwrite but not error when canceled
  3. Test if the file already exists and just message it already exists (no Overwrite\Cancel prompt).

Door #2

prompt to overwrite but no error when canceled or NO is clicked
 
Upvote 0
Code:
Sub Save_Test()
    Dim strFullpath As String
    If Not IsNumeric(Right(Cells(2, 12), 4)) Then
        MsgBox ("blah blah bad")
    Else
        strFullpath = "\\Master01\C\Gallo\" & Right(Cells(2, 12), 4) & ".xls"
        If Dir(strFullpath) <> vbNullString Then
            If MsgBox("File already exists." & vbLf & vbLf & "Do you want to overwrite it?", _
                vbYesNo, "File Exists") = vbNo Then Exit Sub
        End If
        Application.DisplayAlerts = False
            ActiveWorkbook.SaveAs Filename:=strFullpath, FileFormat:=56
        Application.DisplayAlerts = True
        MsgBox ("Blah blah #" & Right(Cells(2, 12), 4) & " has been saved and is now available.")
    End If
End Sub
 
Upvote 0
Thanks Alphafrog. . . the only problem i see is that it's not saving the files in file format:=56. i tried to enter it but as usual i didn't have the right syntax.


If you can include saving the file in excel 5.0 (fileformat:=56) i'd appreciate it.

Thanks
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,862
Members
452,948
Latest member
UsmanAli786

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