OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Visual Basic, loading document from template

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer
View previous topic :: View next topic  
Author Message
wazza187
General User
General User


Joined: 18 Dec 2003
Posts: 6

PostPosted: Thu Dec 18, 2003 8:23 pm    Post subject: Visual Basic, loading document from template Reply with quote

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
Back to top
View user's profile Send private message
wazza187
General User
General User


Joined: 18 Dec 2003
Posts: 6

PostPosted: Thu Dec 18, 2003 8:24 pm    Post subject: Reply with quote

btw i obviously shouldnt have commented out all 3 of the first lines, but i was trying different combinations of things at the time.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group