| View previous topic :: View next topic |
| Author |
Message |
mcanedo General User

Joined: 12 Jan 2005 Posts: 6
|
Posted: Wed May 11, 2005 3:33 pm Post subject: Macro Recorded Does not work |
|
|
Hi:
They way I learned Excel macro programing, was mainly recording macros, and then edting them.
I'm trying to do the same with openoffice, and I record a macro, but when I try to execute it does not work.....
Any Idea what can be wrong?
Regards, Miguel
Here is the code generated by openoffice:
| Code: |
sub pdfpaya
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(3) as new com.sun.star.beans.PropertyValue
args1(0).Name = "URL"
args1(0).Value = "file:///home/mcanedo/Documents/2005/tmp/Estados/Estado_de_Cuenta.pdf"
args1(1).Name = "FilterName"
args1(1).Value = "calc_pdf_Export"
args1(4).Name = "FilterData"
args1(4).Value = Array(Array("UseLosslessCompression",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Quality",0,90,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ReduceImageResolution",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("MaxImageResolution",0,300,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("UseTaggedPDF",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportNotes",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("UseTransitionEffects",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("FormsType",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("PageRange",0,"15",com.sun.star.beans.PropertyState.DIRECT_VALUE))
args1(5).Name = "SelectionOnly"
args1(5).Value = true
dispatcher.executeDispatch(document, ".uno:ExportToPDF", "", 0, args1())
end sub
|
_________________ Search Free Online Movies at http://www.movinex.com
Last edited by mcanedo on Tue Sep 16, 2008 10:20 am; edited 1 time in total |
|
| Back to top |
|
 |
9point9 Moderator

Joined: 31 Aug 2004 Posts: 3875 Location: UK
|
Posted: Wed May 11, 2005 11:39 pm Post subject: |
|
|
Maybe because the file already exists. If you try doing a PDF export like that from a macro, it'll work the first time when no file exists and then won't work afterwards because of the existence of a file. _________________ Arch Linux
OOo 3.2.0
OOoSVN, change control for OOo documents:
http://sourceforge.net/projects/ooosvn/ |
|
| Back to top |
|
 |
B Marcelly Super User

Joined: 12 May 2004 Posts: 1414 Location: France
|
Posted: Thu May 12, 2005 1:26 am Post subject: |
|
|
| Quote: | | The way I learned Excel macro programing, was mainly recording macros, and then edting them. |
Unfortunately, the macro recorder will not teach you how to write macros in OpenOffice.org.
The macro recorder is only a handy tool for quick and dirty macros. If it works, fine.
For real programming you will have to spend time and read documents like StarOffice 7 Programmer's Guide and others, see http://api.openoffice.org/TipsAndTricks/external.html and of course search and read threads in this forum.
As for you macro, it does not work because you changed the argument list more or less at random. The declaration of args1 does not fit its use. And args(2) and args(3) are not filled. _________________ Bernard
OpenOffice.org 1.1.5 fr / OpenOffice.org 3.4.1 en-US + langpacks, MS-Windows XP Home SP3
This forum is unusable, use instead Apache OpenOffice forums |
|
| Back to top |
|
 |
|
|
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
|