Macro to save as XLSB binary format

Asked By Malcolm Snawdon
03-Feb-10 08:53 AM
Earn up to 0 extra points for answering this tough question.

I've written a macro to save a file with a name that is created in Range A1 on Sheet 1. The given file name ends in .xlsb because I want to save it in Binary format (to keep it small)

The Macro starts

Dim TEFileName As Range
    Set TEFileName = Worksheets("Sheet1").Range("A1:A1")
    FileNameAnswer = TEFileName
 
   Dim EXPENSE As Range
   Set EXPENSE = Worksheets("Page1").Range("B52:B52")
    ActiveWorkbook.SaveAs Filename:= _
        FileNameAnswer, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
        ReadOnlyRecommended:=False, CreateBackup:=False
 

The file is then sent to a manager for approval and saved locally with the given filename.

PROBLEM IS IT CANNOT BE REOPENED the message reads

"Excel cannot open the file "abcde.xlsb" because the format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file".

Any ideas how to get round this problem?

 

Thanks

 

 

  re: Macro to save as XLSB binary format

Jonathan VH replied to Malcolm Snawdon
03-Feb-10 10:53 AM

Change the FileFormat option of the SaveAs method to this:

FileFormat:=xlExcel12

Create New Account