Bug 153595 - VBA SaveAs method does not add default file extension
Summary: VBA SaveAs method does not add default file extension
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.1.0.4 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: implementationError
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
 
Reported: 2023-02-13 15:59 UTC by Gabor Kelemen (allotropia)
Modified: 2023-03-28 11:51 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2023-02-13 15:59:28 UTC
This is a continuation of bug 153593

Another issue with the example macro in attachment 185348 [details] is that Excel uses a default extension if there is none given, but Calc does not:

Sub save_as_file_fp()
    ActiveWorkbook.SaveAs _
    Filename:=Application.ActiveWorkbook.Path & ".\FileSaveTest_fp"
End Sub

With the above macro Excel outputs a "FileSaveTest_fp.xlsm" file (saves the example file with the new Filename and same format, adding and extension matching the format) and Calc just "FileSaveTest_fp".

Manually adding an xlsm or xlsx extension, then opening it in Excel gives an "invalid file" error which is the same as bug 118146.
(Adding an xls extension makes Excel open it fine)

1. Open attachment 185348 [details]
2. Run save_as_file_fp()
3. Observe that the created file does not have an xlsm (expected) or any other file name extension.

How it looks after running it in Excel: attachment 185349 [details]
How it looks after running it in Calc: attachment 185352 [details]

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 6028e9fda96d0ed5da266b1c54a7755f7ba3408c
CPU threads: 14; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded

Happens since 4.1, before the SaveAs method was not implemented at all.
Comment 1 Buovjaga 2023-03-28 11:51:47 UTC
Repro.

I had the original file in path libobugs/vboxshare and the macro created a file called vboxshare.\FileSaveTest_fp in libobugs

Arch Linux 64-bit, X11
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 98cf5157d69d9f1692be7f2cac958b1dfb387ca9
CPU threads: 8; OS: Linux 6.2; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 28 March 2023