https://bugs.documentfoundation.org/show_bug.cgi?id=153635
Bug ID: 153635
Summary: VBA Methods could handle file path separators
OS-independently
Product: LibreOffice
Version: Inherited From OOo
Hardware: All
OS: Linux (All)
Status: UNCONFIRMED
Severity: enhancement
Priority: medium
Component: Calc
Assignee: [email protected]
Reporter: [email protected]
Blocks: 108908
Created attachment 185379
--> https://bugs.documentfoundation.org/attachment.cgi?id=185379&action=edit
Modified example file to run on Linux
This is a continuation for bug 139508 and bug 149786
attachment 170014 has the following macro:
Option VBASupport 1
Public Sub printplt1_click()
Dim pdf_template As Worksheet
Set pdf_template = ActiveSheet
Dim wb As Workbook
Set wb = ActiveWorkbook
Dim ws As Worksheet
If Dir(wb.Path & "\" & "export", vbDirectory) = "" Then
MkDir (wb.Path & "\" & "export")
End If
pdf_template.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=wb.Path & "\" & "export" & "\" & "pdf" &
".pdf", _
Quality:=xlQualityStandard,
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
End Sub
Now that ExportAsFixedFormat was implemented, this works on Windows.
However under Linux, all of Dir, MkDir and ExportAsFixedFormat fail because the
paths / filenames are constructed using "\" as path separators, which is
Windows-specific.
It would be nice if such path-handling methods would detect the user intention
and interpret (or convert on file open?) these as the correct platform-specific
path separators, i.e forward slashes.
Of course if such a path starts with "D:\" then all hope is lost, but macros
with relative paths only could work platform-independently.
1. Open attachment 170014
2. Try to run the macro by clicking the button
-> This is supposed to create an export directory and a pdf.pdf from the
document.
This won't happen until you manually change all instances of the "\" to "/" in
the macro editor.
I'm attaching a modified version of the attachment 170014. Now this does not
run in Calc on Windows.
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: e2d8474857e8b39efcdf21441c95ad51a8aef6e8
CPU threads: 16; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: hu-HU (hu_HU.UTF-8); UI: hu-HU
Calc: threaded
Referenced Bugs:
https://bugs.documentfoundation.org/show_bug.cgi?id=108908
[Bug 108908] [META] Visual Basic for Applications (VBA) macro issues
--
You are receiving this mail because:
You are the assignee for the bug.