I have the following problem:
I have to open a file (the file name is variing), but i know the share.
Then I have to restore it under the same directory but in a csv format.
Code: Select all
Sub OpenSpecificFolder()
Dim FP As Object
Dim ShExec As Object
Dim X As Integer
FP = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
Dim s as String
s = "file:///C:/"
FP.SetDisplayDirectory(s)
FP.appendFilter("All files", "*.*")
' X = FP.Execute()
If X = 1 Then
ShExec = createUnoService("com.sun.star.system.SystemShellExecute")
ShExec.execute(FP.Files(0), "", 0)
Dim Url as String
Url = convertToUrl(FP.Files(0))
MsgBox Url
End If
' here i probably have to jump to the opened file
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "URL"
args1(0).Value = Url ' here i have to delete the ending and add .csv
args1(1).Name = "FilterName"
args1(1).Value = "Text - txt - csv (StarCalc)"
args1(2).Name = "FilterOptions"
args1(2).Value = "59,0,76,1"
dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, args1())
End Sub
1).SetDisplayDirectory doesn't work
2)I dont know how to delete the ending of the url and add .csv
It's my first day im working with OO Basic , please help
Thx in advance
Mischa