Send mail with macro

I want to send a mail with a macro. I have code and it works fine, but send attacment in the ods file I want the create in the pdf. My code is:

REM  ****  BASIC  ****

Sub SendEmail
 Dim eMailAddress as String
 Dim eSubject as String
 Dim eMailer as Object
 Dim eMailClient as Object
 Dim eMessage as Object
 
 eMailAddress = "mail1@gmail.com; mail2@gmail.com"
 eSubject = "subject"
 eMailer = createUnoService("com.sun.star.system.SimpleSystemMail")
 
 eMailClient = eMailer.querySimpleMailClient()
 
 eMessage = eMailClient.createSimpleMailMessage()
 eMessage.body = "test1," & chr (10) & chr (10) & "text2." & chr (10) & chr (10) & "text3"
 eMessage.setRecipient(eMailAddress)
 eMessage.setSubject(eSubject)
 
 eMessage.setAttachement(Array(convertToUrl(GetCurrentFile())))
 
 eMailClient.sendSimpleMailMessage(eMessage, 0)
End Sub

Function GetCurrentFile
 Dim path as String
 path = ThisComponent.getURL()
 GetCurrentFile = path
End Function

thx

The you must write a PDF export routine, adn you need use the URL of the created/exported .pdf file.
There are sample code snippets in Andrew pitonyak’s free macro programming books, and on the AOO/LO forums.