how do I press "OK"?

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

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

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