door dirkinductie » vr maart 16, 2018 11:01 pm
Romke, Dank je wel.
Ik kom er even niet meer uit.
Wat doe ik fout en hoe los ik het op?
Sub Mailen()
Dim launcher as object
Dim eAddress, eSubject, eBody, CCeAddr, BCCeAddr, aHTMLanchor as string
dim myDebitNr as string
dim myOrderNr as string
dim Cell1 as object
dim Cell2 as object
dim MailOntvanger
dim Sheet as object
dim Doc as object
Dim eMessage as Object 'nieuw
launcher = CreateUnoService("com.sun.star.system.SystemShellExecute")
'Get the active document:
Doc = Thiscomponent
'Get the active sheet:
Sheet=Doc.getcurrentcontroller.activesheet
'Get a cell by position
Cell1=Sheet.getCellByPosition(9,0) 'These coordinates means: the cell J1
Cell2=Sheet.getCellByPosition(9,1) 'These coordinates means: the cell J2
MailOntvanger=Sheet.getCellByPosition(6,4)
'Get text from a cell:
DebitNr = Cell1.string
OrderNr = Cell2.string
'file:///C:/Facturen/9000_52176.pdf bestandnaam
fileName = _ & DebitNr & "_" & OrderNr & ".pdf" 'nieuw
eMessage.setAttachement (Array("C:/Facturen/9000_52176.pdf")) 'nieuw Met deze regel gaat het mis.
eAddress = MailOntvanger.string
CCeAddr = "factuur@xxxx.nl"
'BCCeAddr = "xxxx@xxxx.nl"
eSubject = "Factuur Boerderij " & DebitNr & "_" & OrderNr
ebody = "Geachte xxxx."
aHTMLanchor = "mailto:" & eAddress & "?cc=" & CCeAddr & "&&subject=" & eSubject & "&&body=" & eBody
launcher.execute(aHTMLanchor, "", 0)
End Sub
Gr. Dirk
LibreOffice Versie: 5.4.2.2 (x64)