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

[solved] How do I clear all modules in a document

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
ernst_org
General User
General User


Joined: 04 Sep 2007
Posts: 38

PostPosted: Thu Mar 12, 2009 6:59 am    Post subject: [solved] How do I clear all modules in a document Reply with quote

Hi List I have made a document that I fill in with a lot of code when it is opende the first time, I would like to delete al modules after I have used them to prevent user getting problems and q from all the user,

How can I do that?


Last edited by ernst_org on Fri Mar 13, 2009 3:00 am; edited 1 time in total
Back to top
View user's profile Send private message
probe1
Moderator
Moderator


Joined: 18 Aug 2004
Posts: 2560
Location: Chonburi Thailand Asia

PostPosted: Thu Mar 12, 2009 8:19 am    Post subject: Reply with quote

First idea is not to store them in the document in question...
_________________
Cheers
Winfried
My Macros
DateTime2 extension: insert date, time or timestamp, formatted to your needs
Back to top
View user's profile Send private message Visit poster's website
ernst_org
General User
General User


Joined: 04 Sep 2007
Posts: 38

PostPosted: Fri Mar 13, 2009 1:37 am    Post subject: Reply with quote

But in this organisation you have to, there are 100 off different template and different rules and so on.
Back to top
View user's profile Send private message
probe1
Moderator
Moderator


Joined: 18 Aug 2004
Posts: 2560
Location: Chonburi Thailand Asia

PostPosted: Fri Mar 13, 2009 2:21 am    Post subject: Reply with quote

Ok, so ...

Code:
oBLs = ThisComponent.BasicLibraries
oBL = oBLS.getByName( "Standard" )
oBL.removeByName( "Module1" )


deletes Module1 without question.

Does this help?
_________________
Cheers
Winfried
My Macros
DateTime2 extension: insert date, time or timestamp, formatted to your needs
Back to top
View user's profile Send private message Visit poster's website
ernst_org
General User
General User


Joined: 04 Sep 2007
Posts: 38

PostPosted: Fri Mar 13, 2009 2:59 am    Post subject: Reply with quote

Thanks solved Razz
Back to top
View user's profile Send private message
MrBill1028
General User
General User


Joined: 13 Sep 2008
Posts: 15
Location: COLORADO

PostPosted: Tue Jul 07, 2009 6:23 am    Post subject: Getting Exception Error Reply with quote

When I try to use this code I get an exception error or library not loaded error or variable not defined (I've tried several work a rounds) I'm trying to delete more then one module from different libraries within in the template. If I just use this code once it seems to work OK if I place several occasions of this code together to remove the rest of the modules it starts throwing errors. How would you use this to delete more then 1 module. Using Ooo 3.1 THANKS
_________________
Rank Amateur Willing To Learn
Back to top
View user's profile Send private message
ernst_org
General User
General User


Joined: 04 Sep 2007
Posts: 38

PostPosted: Tue Jul 07, 2009 10:55 pm    Post subject: Reply with quote

I do like this, do not forget that you canĀ“t delete your deletemodule. my module1

Code:


Sub RemoveHistory
on error goto rRemov_error

oBLs=ThisComponent.BasicLibraries
oBL = oBLS.GetByName("Standard")
oBL.removeByNAme("HelpText")
oBL.removeByNAme("Ini")
oBL.removeByNAme("Registry")
oBL.removeByNAme("zoom")

rRemov_error:
   reset
   exit sub
End Sub
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 Macros and API 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