Bug 153593 - VBA SaveAs method with relative file paths does not work
Summary: VBA SaveAs method with relative file paths does not work
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:29 UTC by Gabor Kelemen (allotropia)
Modified: 2023-03-28 11:48 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Calc (49.75 KB, application/vnd.ms-excel.sheet.macroEnabled.12)
2023-02-13 15:29 UTC, Gabor Kelemen (allotropia)
Details
List of created files after running all the macros in Excel 2016 (131.91 KB, image/png)
2023-02-13 15:33 UTC, Gabor Kelemen (allotropia)
Details
Error message by Calc master (62.06 KB, image/png)
2023-02-13 15:34 UTC, Gabor Kelemen (allotropia)
Details
Same error message with the third macro as well (57.24 KB, image/png)
2023-02-13 15:34 UTC, Gabor Kelemen (allotropia)
Details
Saving with the save_as_file_fp is successful (87.54 KB, image/png)
2023-02-13 15:40 UTC, Gabor Kelemen (allotropia)
Details

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:29:09 UTC
Created attachment 185348 [details]
Example file from Calc

This is a bit of continuation after bug 149786
Attached example file is derived from attachment 181030 [details] of that bug.

Now that the ExportAsFixedFormat is implemented, we see it failing on the filename specification used in that macro: 
 Filename:=".\ExportAsPDF.pdf",

A bit of experimentation found that the SaveAs method also has this error.

1, Open attached file
2, Run the macros in Calc

Result: when running the ExportAsPDF macros (with https://gerrit.libreoffice.org/c/core/+/146512 applied locally), they save the PDF files correctly except the  Filename:=".\ExportAsPDF_dot.pdf" case.

The save_as_file macros are worse: only the save_as_file_fp works, and the other two with filename specifications:
    Filename:=".\FileSaveTest_dot"
and
    Filename:="FileSaveTest_fn"
cause an error dialog.

These should produce an output file like save_as_file_fp() does.

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 Gabor Kelemen (allotropia) 2023-02-13 15:33:29 UTC
Created attachment 185349 [details]
List of created files after running all the macros in Excel 2016
Comment 2 Gabor Kelemen (allotropia) 2023-02-13 15:34:04 UTC
Created attachment 185350 [details]
Error message by Calc master
Comment 3 Gabor Kelemen (allotropia) 2023-02-13 15:34:55 UTC
Created attachment 185351 [details]
Same error message with the third macro as well
Comment 4 Gabor Kelemen (allotropia) 2023-02-13 15:40:51 UTC
Created attachment 185352 [details]
Saving with the save_as_file_fp is successful

With an absolute path given the save succeeds.
File extension was not auto-added, will file that as a separate report.
Comment 5 Buovjaga 2023-03-28 11:48:22 UTC
I confirm the save as error.

The PDF file produced:
.\ExportAsPDF_dot.pdf

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