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

Changing DOCUMENT variable with Macro

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


Joined: 29 Apr 2006
Posts: 7

PostPosted: Sun Apr 30, 2006 7:00 am    Post subject: Changing DOCUMENT variable with Macro Reply with quote

Hey guys!

I have a quick question to you =). I'm working over OO.o Writer

I set a variable with:
Insert > Fields > Other > Variable tab

How can I change the value of that variable with a macro?

I want to put a button and when I push the button, activate the macro and that macro change the value of my variable. But what are the instructions needed for do that?

I tryed the next:
1.- I set a document variable named v1 = 16, (with Insert > Fields > Other > Variable tab)
2.- I created a macro module, with a Sub named macro1
3.- In the macro I put
Code:
sub macro1

dim document   as object
dim dispatcher as object
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
print v1

end sub

4.- When I run the macro, I get a blank msgbox, because v1 in the macro is a totally differente variable than v1 of my document.

Do you have an idea?

Thanks
_________________
Another newb bits the dust
Running OO.o 2.0 over Windows XP SP2
Back to top
View user's profile Send private message
probe1
Moderator
Moderator


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

PostPosted: Sun Apr 30, 2006 9:13 am    Post subject: Reply with quote

I don't do this with dispatcher calls.
Please do a search, some of what if found:
creating user field using macro
http://www.oooforum.org/forum/viewtopic.phtml?t=18148

Change user-defined variable in writer
http://www.oooforum.org/forum/viewtopic.phtml?t=4546

HTH
_________________
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
White_Dragoon
General User
General User


Joined: 29 Apr 2006
Posts: 7

PostPosted: Sun Apr 30, 2006 11:58 am    Post subject: Reply with quote

probe1 wrote:
I don't do this with dispatcher calls.
Please do a search, some of what if found:
creating user field using macro
http://www.oooforum.org/forum/viewtopic.phtml?t=18148

Change user-defined variable in writer
http://www.oooforum.org/forum/viewtopic.phtml?t=4546

HTH


Thanks probe1. The 2nd link was in special useful. But I have a problem with a posted code in there: Do you know where can I found the properties and methods of the objects used in Basic?

And yes, I promise use the search option the next time Embarassed

Thanks =)
_________________
Another newb bits the dust
Running OO.o 2.0 over Windows XP SP2
Back to top
View user's profile Send private message
White_Dragoon
General User
General User


Joined: 29 Apr 2006
Posts: 7

PostPosted: Sun Apr 30, 2006 2:26 pm    Post subject: Reply with quote

In the next post I found the solution: thanks =)

http://www.oooforum.org/forum/viewtopic.phtml?p=143360#143360
_________________
Another newb bits the dust
Running OO.o 2.0 over Windows XP SP2
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