I have attached a simple macro to a push button which works okay , however , when I press this button the design toolbar come on every time I press it , very frustrating , great product , obvioulsly Im missing something here.
many thanks
Andyp
[Solved] Push button macro
Re: Push button macro
Andy, please read the Survival Guide for the forum. This give basic guidance on how to look for answers, and how to frame you questions to help us to help you. So what package are you doing this in? Calc, Writer or what? What is the context. You've got to give us a clue, eh?
If your macro is a Basic macro (e.g. ActionButton1) then your macro properties should be something like:
If your macro is a Basic macro (e.g. ActionButton1) then your macro properties should be something like:
- Mouse button pressed vnd.sun.star,script?Standard.Module1.ActionButton?language=basic&location=document(.)
Ubuntu 11.04-x64 + LibreOffice 3 and MS free except the boss's Notebook which runs XP + OOo 3.3.
Re: Push button macro
Thanks Terry , sorry am using calc , and your answer does show when mouse button pressed the correct syntax.
However I can get the macro working okay , but when I save and re-load and go to the button it goes into design mode striaght off and no toolbar shows i.e Form controls.
Sorry Im new to this.
Thanks for your help.
Andy
However I can get the macro working okay , but when I save and re-load and go to the button it goes into design mode striaght off and no toolbar shows i.e Form controls.
Sorry Im new to this.
Thanks for your help.
Andy
Re: Push button macro
Andy, I just did my test with a shape action pointing to
A save / close / reopen bring the spreedstheet back in the corect context and pressing the shape gives a message box containing "Hello World".
What does your macro do? What is its context?
The only way I can get it to go into design mode is to right click on the button.
Code: Select all
Sub ActionButton
Print "Hello World"
End Sub
What does your macro do? What is its context?
The only way I can get it to go into design mode is to right click on the button.
Ubuntu 11.04-x64 + LibreOffice 3 and MS free except the boss's Notebook which runs XP + OOo 3.3.
Re: Push button macro
Thanks Terry, my macro is just a goto to another sheet. I have managed to get this to work okay in a new file.
I think the problem my be with the original file which was converted from Excel , when I look at the code for the macro is states the following first line;
Rem Attribute VBA_ModuleType=VBAModule , where in the new book I tried it states REM ****bASIC **** in first line, this may be where the problem maybe but would not now what the answer is ?
cheers
andyp
I think the problem my be with the original file which was converted from Excel , when I look at the code for the macro is states the following first line;
Rem Attribute VBA_ModuleType=VBAModule , where in the new book I tried it states REM ****bASIC **** in first line, this may be where the problem maybe but would not now what the answer is ?
cheers
andyp
Re: Push button macro
Ah, the light dawns. The Survival Guide is there for a reason. You didn't give a full explanation. When you convert a XLS spreadsheet with a VBA macro, the macro code is REMmed out since the VBA and OOo APIs are different. The subroutine that you need to go to another sheet is where you need to change the Sheet2 to whatever.
Code: Select all
Sub GotoSheet2
ThisComponent.CurrentController.ActiveSheet = ThisComponent.Sheets.getByName("Sheet2")
End Sub
Ubuntu 11.04-x64 + LibreOffice 3 and MS free except the boss's Notebook which runs XP + OOo 3.3.
Re: Push button macro
Thanks Terry , soory for not giving you full info , it now works fine.
Thanks a lot.
Andy
Thanks a lot.
Andy
Re: Push button macro
Andy, we're here to help. Glad to oblige.
Ubuntu 11.04-x64 + LibreOffice 3 and MS free except the boss's Notebook which runs XP + OOo 3.3.