VBA:
Code: Select all
Sub macrogravar()
'
' macrogravar Macro
'
'
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="D:\Caixadiario\ " & Range("e2") & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
Range("H23").Select
End Sub
On the office calc I have this code:
sub gravarpdf
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(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "URL"
args1(0).Value = "file:///D:/caixadiario/ . pdf"
args1(1).Name = "FilterName"
args1(1).Value = "calc_pdf_Export"
args1(2).Name = "FilterData"
.......
dispatcher.executeDispatch(document, ".uno:ExportToPDF", "", 0, args1())
end sub