On Tue June 13 2006 11:03, + Tobias Burnus wrote:
>  [ MODERATED ] ***********************
> Hello,
>
> this is kind of a follow up to my question in 2003
> (http://www.openoffice.org/servlets/ReadMsg?list=users&msgNo=17481).
>
> I would like to add a button to the toolbar, which upon clicking creates
> a new document based on a certain template.
>
> Unfortunally, the macro recoder does not work and I couldn't find the
> right macros to write this macro myself.
>
> With OpenOffice 1.x the following macro (see link above) worked:
>
> Sub CallTemplate
>   dim oTemplate as object
>   dim sTemplatePath as string
>   dim mNoArgs()
>   sTemplatePath="file:///C:/WINNT/Profiles/des.DOUGAN.000/Application
> Data/OpenOffice.org/user/template/VCC/Memo.stw"
>   oTemplate = StarDesktop.LoadComponentFromURL(sTemplatePath, "_blank",
> 0, mNoArgs())
> End sub
>
> But if I use this macro with OpenOffice 2.0.x, printing does not work
> and the filename (according to the window caption) is "" rather than
> "Untitled<n>". (Workaround: Click on the edit button twice - brings up
> "readonly - create copy"; that copy I can now print.)
>
> Any ideas how a properly working macro looks like?
>
> Tobias
>
> PS: The missing macro recorder is issue 66183 (OOo later), that the old
> marco doesn't work is issue 66184 (unconfirmed).

As you are not subscribed you may not have seen that:
On Thu June 15 2006 13:44, Andrew Douglas Pitonyak wrote:
>
> I am of the opinion that this macro should not have worked as a
> template... It should have merely opened the document normally... Does
> this work for you?
> Sub NewDoc
>   Dim oDoc
>   Dim sPath$
>   Dim a(0) As New com.sun.star.beans.PropertyValue
>   a(0).Name = "AsTemplate"
>   a(0).Value = true
>
>   sPath$ = "file://~/Documents/DocTemplate.stw"
>   oDoc = StarDesktop.LoadComponentFromUrl(sPath$, "_blank" , 0, a())
> End Sub


Please reply to [email protected] only.


-- 
CPH : openoffice.org contributor

Maybe your question has been answered already?
                                http://user-faq.openoffice.org/#FAQ

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to