wazza187 General User

Joined: 18 Dec 2003 Posts: 6
|
Posted: Thu Dec 18, 2003 8:23 pm Post subject: Visual Basic, loading document from template |
|
|
G'Day Folks,
This is my first post, but ive been looking through the entries whih have been very useful.
We have macros for MS office, and im converting them to work with OpenOffice, and at the same time, removing the macros from the documnet, and putting them in a standalone visual basic program.
At the moment, what i want to do is open a document from a template (template.dot is existing one but i could convert to template.std). I dont need macros to run within the new document.
i have the folowing snippet:
'*************************************
Sub oLoadTemplate(TemplateName As String)
Dim FileToLoad As String
'FileToLoad = "file:///C:\WINDOWS\Desktop\openoffice\vb code\doc maniulation\New Folder\template.std"
'FileToLoad = "C:\WINDOWS\Desktop\openoffice\vb code\doc maniulation\New Folder\" & TemplateName & ".dot"
'FileToLoad = pathname$ + "\refmacro\docs\dsc" & TemplateName & ".dot"
If Dir(FileToLoad) = "" Then
MsgBox "Sorry, this file is under repair" & vbLf & "Give me a minute and it'll be fixed" & vbLf & "Thanks."
End If
'********two ways of doing it
'FIRST METHOD
'basic = createUnoService("com.sun.star.frame.Desktop")
'oDoc = basic.loadComponentFromURL(ConvertToURL(FileToLoad), "_blank", 0, Array(MakePropertyValue("AsTemplate", True)))
'SECOND METHOD
oDoc = StarDesktop.loadComponentFromURL(ConvertToURL(FileToLoad), "_blank", 0, Array())
**this is the code that works with MS office****
'Documents.Add Template:=FileToLoad, NewTemplate:=False
End Sub
'*****************
End of code.
OK, now the first method cant find createUnoService and the 2nd method cant find ConvertToURL.
What can i do? can i find those functions and put them inthis code, or to i have to add a library / headerfile / link the program to something?
Thanks for your help,
Warwick Black |
|