File format : xla behaving strangely
lucas-v opened this issue · 8 comments
When saving a workbook with the xlAddIn
(18) file format, the wb.FileFormat property has the value 56 instead of 18.
Code to reproduce
Dim wb As Workbook
Set wb = vtkCreateExcelWorkbook()
wb.SaveAs "C:\Any\Path\Will\Do\xxxx.xla", FileFormat:=xlAddIn
Debug.Print "xla = " & xlAddIn
Debug.Print "actual = " & wb.FileFormat
vtkCloseAndKillWorkbook wb
Results are :
xla = 18
actual = 56
Notes
The behaviour for other file formats, such as :
xlOpenXMLWorkbookMacroEnabled
forxlsm
filesxlOpenXMLAddIn
forxlam
filesxlExcel8
forxls
files
is normal.
The effective format of the created .xla is .xls file (fileFormet=56).
Plus, this file is not opened by Excel2003 (bad file format). I think it's because .xla extension and fileFormat parameter are not matching each other. I had to manually recreate the .xla file to get a true AddIn Excel 2003 file (with extension .xla and fileFormat=18).
Perhaps, set the .IsAddIn property of this workbook to True will solve both problems :
- a fileFormat inconsistent with extension
- a file not openable with Excel 2003
Setting the IsAddIn property to True actually solves the problem of the format. 👍
Does the following code gives a file openable by Excel 2003 — if you have it around ?
Dim wb As Workbook
Set wb = vtkCreateExcelWorkbook()
wb.IsAddin = True
wb.SaveAs "C:\Any\Path\Will\Do\xxxx.xla", FileFormat:=xlAddIn
Debug.Print "xla = " & xlAddIn
Debug.Print "actual = " & wb.FileFormat
' vtkCloseAndKillWorkbook wb
Je n'ai pas de 2003 sous la main ; j'essaie avec la dernière version de VBAToolKit cette semaine chez le client.
The generated XLA is now recognized by Excel : the format is good.
But there is a crash because the name of the project should be "VBAToolKit". It doesn't work with "VBAToolKit_2003"
Does renaming the project name manually change anything ?
Otherwise an optional "VBProjectName overrride" field must be added in the configuration objects.
Manually renaming the project seems a good workaround: no crash when I did it.
A manual operation is not a good practice. The issue will be closed when a complete fix will be done.
The simplest way seems to add an optional "projectName" attribute to the XML configuration element.
Good thing we have a working workaround. I'll fix the issue soon.
It's the Story#24 in the IceScrum Backlog.
A lot of stories not to be estimated; the next sprint can't be planned.