Issue 59047 - Macros in a new document based on a template did not work
Summary: Macros in a new document based on a template did not work
Status: CLOSED DUPLICATE of issue 58527
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC Windows XP
: P3 Trivial
Target Milestone: ---
Assignee: ab
QA Contact: issues@api
URL:
Keywords: oooqa
Depends on:
Blocks:
 
Reported: 2005-12-07 20:09 UTC by thomaskrumbein
Modified: 2013-02-24 21:08 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
template with macro (6.77 KB, application/vnd.oasis.opendocument.text)
2005-12-08 15:06 UTC, stephan.wunderlich
no flags Details
Template with mcro and form (8.06 KB, application/vnd.sun.xml.writer)
2005-12-08 16:04 UTC, thomaskrumbein
no flags Details
Error -message (32.21 KB, image/jpeg)
2005-12-08 16:51 UTC, thomaskrumbein
no flags Details
error picture2 (14.17 KB, image/jpeg)
2005-12-08 16:52 UTC, thomaskrumbein
no flags Details
orginal file customer (16.84 KB, application/vnd.oasis.opendocument.text)
2005-12-08 16:53 UTC, thomaskrumbein
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description thomaskrumbein 2005-12-07 20:09:42 UTC
If a new document is produced based on a Template (i.e.  *.ott) and template
will have (Basic-) Macros inside, these Macros are not accessible before the new
document has no URL (is stored). 
Try the following way:
open a new Document (text). Write a short macro and store it in Module1,
Standard library, inside the document. 
Store the document as *,ott (template), close it. 
Now open the template (*.ott) with a double-click on the name, an new untitled
writer-document will be open. 
Try Extras - Makro - Makros ausführen... (sorry, just a german version) and the
dialog will only display two Sections: MyMakros and OpenOffice.org Macros. Ther
is no display of the document macros, therefor you cannot start it. 
Even if yo try to start it via a button or anything else, you will get an
com.sun.star.uno.RuntimeExeption.
Only way to access the macro is: Extras - Makro - Makros verwalten -
OpenOffice.org Basic.  In this dialog the document-Macros are accessible and you
can push the button "execute".

So it is not possible to start a macro in a document which was created via
template and do not have a URL. 
This behavier is different to the 1.1.x line,  where we do not have any problems
 on this.
Comment 1 stephan.wunderlich 2005-12-08 15:06:48 UTC
Created attachment 32206 [details]
template with macro
Comment 2 stephan.wunderlich 2005-12-08 15:08:13 UTC
sw->thomaskrumbein: I've attached a template and when I open it inside OOo I can
access the macro at the created Untitled1 without problem ... what do I miss ?
Comment 3 thomaskrumbein 2005-12-08 16:02:03 UTC
-> sw: well, your dokument works. So I will give you some more details: effect
occurs obviously only, when ther is minimum one form inside of the Document.

So I add some contolls to your document (two text-controls and one button), the
button is connected to your makro. 

Create a new document based on the new template, push the button -> Error as
mentioned prior. 
Even you cannot access teh macro via Extras - Makro - Makros ausführen...  - no
document-Macros are available. 
Then give the document an URL -> everything ok.
Comment 4 thomaskrumbein 2005-12-08 16:04:14 UTC
Created attachment 32209 [details]
Template with mcro and form
Comment 5 stephan.wunderlich 2005-12-08 16:21:31 UTC
sw->thomaskrumbein: mmmm ... also with your sample I have no problem with
accessing the macro ... not with OOo2.0 and not with the development build
OOo_m3_8968 ... any ideas what I'm missing ? ... I just opened the template and
then chose "Tools-Macro-Run Macro ...", which showed me Untitled1 and so I could
start the macro.
Comment 6 thomaskrumbein 2005-12-08 16:46:24 UTC
-> sw: No. I can reproduce this error at any time - even with other documnents.
My Way: I have stored this template (macro_tk.ott) local on my computer (System
Win XP, SP2). I use the Windows-Explorer and make a double-Klick on the filename
-> OOo starts and produce a new document in writer (untitled1). 
When I try to push the button, a msgbox appears and told me: Title:
OpenOffice.or g Fehler, message: com.sun.star.uno.RuntimeExeption. 
Picture attached (Fehler1.jpg).
And I cannot access the document macros (fehler2.jpg). 
My System: OOo m142 build 8984

But: a customer mentioned this problem - send me his file and i could reproduce
the error. Then I create new documents and can reproduce again. 
When I opened your document everything work ok. I did not store the new created
doc, then I add some controls and try to combine the macro to the button. When
the window (dialog) come up to select the macro-name, there where no
document-macros listed, even the place "unbekannt1" was not listed. So I store
first the document, then assign the macro to the button. Same problem???

Comment 7 thomaskrumbein 2005-12-08 16:51:50 UTC
Created attachment 32212 [details]
Error -message
Comment 8 thomaskrumbein 2005-12-08 16:52:42 UTC
Created attachment 32213 [details]
error picture2
Comment 9 thomaskrumbein 2005-12-08 16:53:19 UTC
Created attachment 32214 [details]
orginal file customer
Comment 10 thomaskrumbein 2005-12-08 16:58:02 UTC
I just try your modified doc on an different computer (Win XP, OOo 2.0.1) -
well, works ok ????
then I try the orginal Doc, which creates the problems by my customer an even on
my computer -> well, error is again reproduceble. 
So I put the orginal doc in attachment - please use confidential.
The doc covers a form with two controls, the macro is assign to "Lost Focus" of
the second control -> Aktenzeichen. 
Maybe it helps?
Comment 11 stephan.wunderlich 2005-12-08 17:23:59 UTC
Seems the one has to close the document in between ... well at least then I
could reproduce it.

What I did
1. open the office
2. open the document macro_tk.ott
3. press the button

=> a message box greeting you appears

4. close the document
5. open it again
6. press the button 

=> a RuntimeException appears

7. choose "Tools-Macro-Run Macro" => the document "Untitled1" isn't available

The Office needs to be closed and opened again to make the macro work ... or the
document has to be saved.

sw->tbe: I send it to you since my first guess would be that something with the
scripting framework is faulty.
Comment 12 stephan.wunderlich 2005-12-09 08:44:57 UTC
changing owner
Comment 13 thomas.benisch 2005-12-09 09:11:04 UTC
TBE->AB: Something for you.
Comment 14 andreschnabel 2005-12-11 22:02:47 UTC
this might be a duplicate to issue 58527?

Comment 15 ab 2006-01-11 13:35:26 UTC
Yes, most probably a duplicate to issue 58527
-> set to DUPLICATE, will check again when issue 58527 is resolved


*** This issue has been marked as a duplicate of 58527 ***
Comment 16 andreschnabel 2006-03-25 13:01:37 UTC
verified in OOo 2.0.2 -> close