How to save a file on current path and particular path (eg. d:\) using macro.(using open office 2.0)

How to save a file on current path and particular path using macro.

Read these guidelines and ask a good question.

Sub Writer_ToDocumentFolder(Optional pDoc As Object)
REM Reworked to also run in very old versions.
If IsMissing(pDoc) Then
theDoc = ThisComponent
Else
theDoc = pDoc
End If
docUrl = theDoc.URL
If NOT FileExists(docUrl) Then
MsgBox(“The document must be saved to an URL for this routine to work.”)
Exit Sub
End If
If NOT theDoc.supportsService(“com.sun.star.text.TextDocument”) Then
Exit Sub
End If
doc1 =Right(docURL,Len(docURL)-9)
cspath = (“file:///E” & doc1)
Dim storeArgs(0) As New com.sun.star.beans.PropertyValue
storeArgs(0).Name = “FilterName”
storeArgs(0).Value = “StarWriter 5.0”

theDoc.storeToURL(cspath, storeArgs())
MsgBox(“transfered” & cspath)

End Sub