how do I press "OK"?

asked 2018-11-28 07:09:33 +0200

Todd2 gravatar image

updated 2018-11-28 18:07:12 +0200

Hi All,

I am running a macro to save a table as a png. I get a pop up for "PNG Options" --> "Help", "OK", "Cancel".

How do I press the "OK" button from the macro?

Many thanks, -T

edit: code as requested by gabix.

Public sub ExportTable( TableName As String )
   dim document   as object
   dim dispatcher as object
   dim MsgRtn     as Integer

   ' rem get access to the document
   document   = ThisComponent.CurrentController.Frame
   dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

   dim args1(0) as new com.sun.star.beans.PropertyValue
   args1(0).Name = "Nr"
   args1(0).Value = 2

   dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args1())

   dim args2(0) as new com.sun.star.beans.PropertyValue
   args2(0).Name = "ToPoint"
   args2(0).Value = "$A$1:$I$21"

   dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())

   dim args3(3) as new com.sun.star.beans.PropertyValue
   args3(0).Name = "URL"
   args3(0).Value = "file:///" + TableName
   args3(0).Value = Replace( args3(0).Value, "\", "/" )
   MsgRtn = MsgBox( args3(0).Value, 0, "ExportTable" )
   args3(1).Name = "FilterName"
   args3(1).Value = "calc_png_Export"
   args3(2).Name = "FilterData"
   args3(2).Value = Array(Array("Compression",0,6,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Interlaced",0,1,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Translucent",0,1,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("PixelWidth",0,767,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("PixelHeight",0,748,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("LogicalWidth",0,20291,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("LogicalHeight",0,19788,com.sun.star.beans.PropertyState.DIRECT_VALUE))
   args3(3).Name = "SelectionOnly"
   args3(3).Value = true

   dispatcher.executeDispatch(document, ".uno:ExportTo", "", 0, args3())
end sub
edit retag flag offensive close merge delete

Comments

Read these guidelines and ask a good question. In particular, show the macro code.

gabix gravatar imagegabix ( 2018-11-28 14:30:37 +0200 )edit

Anyone? Is there a way to add "press the okay" into args3?

Todd2 gravatar imageTodd2 ( 2018-12-01 00:24:41 +0200 )edit