I know how to auto open CSV file in Macro, but this time I need to open input as a Excel file How can I open file when I run libreoffice macro
Here I am using code to open CSV file open as a input
Code: Select all
Sub MacroTest
Dim oDocument as Object
FName="D:\\input_file"
fnURL=ConvertToURL(FName+".csv")
'Create new document and import data
oDocument = StarDesktop.LoadComponentFromURL( fnURL, "_blank", 0, _
Array(MakePropertyValue( "FilterName", "Text - txt - csv (StarCalc)" ), _
MakePropertyValue( "FilterOptions", "59/9,34,0,1,1/1/1/1/1/1/1/1" )
''' Function
Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
oPropertyValue = createUnoStruct( "com.sun.star.beans.PropertyValue" )
If Not IsMissing( cName ) Then
oPropertyValue.Name = cName
EndIf
If Not IsMissing( uValue ) Then
oPropertyValue.Value = uValue
EndIf
MakePropertyValue() = oPropertyValue
End Function
If anybody knows,.
Thnks
V