I get the error " BASIC runtime error. Object variable not set" in the following line
Code: Select all
Doc.storeAsURL(Url, FileProperties())
Full code snippet is given below
Code: Select all
sub SaveAsTest
Dim Doc
Dim Dummy()
Dim Url As String
Dim SearchFlags As Long
SearchFlags = com.sun.star.frame.FrameSearchFlag.CREATE + _
com.sun.star.frame.FrameSearchFlag.ALL
Url = "file:///C:/temp/test.odt"
Doc = StarDesktop.loadComponentFromURL(Url, "MyFrame", SearchFlags, Dummy)
Dim FileProperties(0) As New com.sun.star.beans.PropertyValue
' ... Initialize Doc
Url = "file:///c:/temp/test3.odt"
FileProperties(0).Name = "Overwrite"
FileProperties(0).Value = True
Doc.storeAsURL(Url, FileProperties())
end sub