You have to add some non-recorded code to do this. If the
file name is in cell D1 of a sheet named Sheet1, the code at the end of your macro would look like this.
Code: Select all
oDoc = ThisComponent
Sheets = oDoc.Sheets
Sheet = Sheets.getByName("Sheet1") 'change this to your sheet name
Cell = Sheet.getCellRangeByName("D1") 'change this to the cell that has the file name
FileName = Cell.String
FileNameWithExtension = Filename + ".ods"
DirectoryName = "file:///C:/Documents%20and%20Settings/Steve_Martin/My%20Documents/bowling_docs/"
FullFileName = DirectoryName + FileNameWithExtension
rem ----------------------------------------------------------------------
dim args7(1) as new com.sun.star.beans.PropertyValue
args7(0).Name = "URL"
args7(0).Value = FullFileName
args7(1).Name = "FilterName"
args7(1).Value = "calc8"
dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, args7())
End Sub
This just gets the
file name from the cell, adds the .ods and directory information to the
name and uses this constructed
name as the value of args7(0).Value.