Hi
I've created an .ics file (which is working perfectly) and saved it in C:\iCalender. The file is called "SendToTechiCalendar795" were 795 is referring to an errand number.
Since I can't use the same method as when I email .pdf files, I need to make this workaround (save the file first).
I can't figure out how to pick that specific file and send it as an attachment to a specific recipient.
It's mostly the "picking" and "attach to email" method I can't figure out.
Code:
-----
Private Sub SendToTech_Click()
On Error GoTo SendToTech_Err
Dim stLinkCriteria As String
Dim File As String
Dim MailTo As Integer
Dim intSearch As String
Dim Filename As String
Dim FileName2 As String
Dim NewAttachmentName As String
Dim SubjectEmail As String
Dim MailAtt As String
Filename = "C:\ErrandSend\SendToTechiCalendar" & Me!Turnr & ".ics"
SubjectEmail = "New errand " & Me!Turnr & ""
MailAtt = TDUFORMAT
File = "SendToTechiCalendar"
NewAttachmentName = SubjectEmail
DoCmd.OutputTo acOutputReport, File, acFormatTXT, Filename, False
DoCmd.OpenReport File, acViewPreview, , , acHidden
Reports(File).Caption = NewAttachmentName
DoCmd.OpenReport File, acViewPreview, , stLinkCriteria, , acWindowNormal
DoCmd.SendObject acReport, File, "PDFFormat(*.pdf)", MailAtt, "ole.traulsen@gmail.com", "", SubjectEmail, "Hereby a new errand ", True, ""
MsgBox "The errand is saved in C:\ErrandSend\SendToTechiCalendar and emailed to fitter", vbOKOnly, "Information"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
'stLinkCriteria = "Turnr=" & Me!Turnr
'FileName2 = "C:\Errands\Closed Errand " & Me!Turnr & "- " & Date & ".pdf"
'DoCmd.OutputTo acOutputReport, DeliveryNote, acFormatTXT, FileName2, False
'MsgBox "The specification has been saved in C:\Errands", vbOKOnly, "Information"
'DoCmd.Close acReport, DeliveryNote, acSaveYes
SendToTech_Exit:
Exit Sub
SendToTech_Err:
MsgBox "The task can't be preformed right now.", vbOKOnly, "Error message"
Resume SendToTech_Exit
End Sub
-----
Any Ideas?
I've created an .ics file (which is working perfectly) and saved it in C:\iCalender. The file is called "SendToTechiCalendar795" were 795 is referring to an errand number.
Since I can't use the same method as when I email .pdf files, I need to make this workaround (save the file first).
I can't figure out how to pick that specific file and send it as an attachment to a specific recipient.
It's mostly the "picking" and "attach to email" method I can't figure out.
Code:
-----
Private Sub SendToTech_Click()
On Error GoTo SendToTech_Err
Dim stLinkCriteria As String
Dim File As String
Dim MailTo As Integer
Dim intSearch As String
Dim Filename As String
Dim FileName2 As String
Dim NewAttachmentName As String
Dim SubjectEmail As String
Dim MailAtt As String
Filename = "C:\ErrandSend\SendToTechiCalendar" & Me!Turnr & ".ics"
SubjectEmail = "New errand " & Me!Turnr & ""
MailAtt = TDUFORMAT
File = "SendToTechiCalendar"
NewAttachmentName = SubjectEmail
DoCmd.OutputTo acOutputReport, File, acFormatTXT, Filename, False
DoCmd.OpenReport File, acViewPreview, , , acHidden
Reports(File).Caption = NewAttachmentName
DoCmd.OpenReport File, acViewPreview, , stLinkCriteria, , acWindowNormal
DoCmd.SendObject acReport, File, "PDFFormat(*.pdf)", MailAtt, "ole.traulsen@gmail.com", "", SubjectEmail, "Hereby a new errand ", True, ""
MsgBox "The errand is saved in C:\ErrandSend\SendToTechiCalendar and emailed to fitter", vbOKOnly, "Information"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
'stLinkCriteria = "Turnr=" & Me!Turnr
'FileName2 = "C:\Errands\Closed Errand " & Me!Turnr & "- " & Date & ".pdf"
'DoCmd.OutputTo acOutputReport, DeliveryNote, acFormatTXT, FileName2, False
'MsgBox "The specification has been saved in C:\Errands", vbOKOnly, "Information"
'DoCmd.Close acReport, DeliveryNote, acSaveYes
SendToTech_Exit:
Exit Sub
SendToTech_Err:
MsgBox "The task can't be preformed right now.", vbOKOnly, "Error message"
Resume SendToTech_Exit
End Sub
-----
Any Ideas?