Hi,
We have a form in excel which has to be exported to pdf and then it as to be sent by e-mail. The VBAcoding is finished and works just fine, but it doesn’t work when it’s put on aSharepoint workgroup with read only access. I think it has to do withtemporarily saving the pdf before it’s killed at the end of coding. How can I divertthis read only option. The file is used by several people all over Europe, so Idon’t have a specific drive letter or common path. Can you help me with thisone ?
This the code
We have a form in excel which has to be exported to pdf and then it as to be sent by e-mail. The VBAcoding is finished and works just fine, but it doesn’t work when it’s put on aSharepoint workgroup with read only access. I think it has to do withtemporarily saving the pdf before it’s killed at the end of coding. How can I divertthis read only option. The file is used by several people all over Europe, so Idon’t have a specific drive letter or common path. Can you help me with thisone ?
This the code
Code:
Sub send_something()
Dim OutlookApp As Object
Dim OutLookMailItem As Object
Dim PdfFile As String, Title As String
Dim myAttachments As Object
' Not sure for what the Title is
Title = ActiveSheet.Range("A5")
' Define PDF filename
PdfFile = ActiveWorkbook.FullName
i = InStrRev(PdfFile, ".")
If i > 1 Then PdfFile = Left(PdfFile, i - 1)
' PdfFile = PdfFile & "_" & ActiveSheet.Name & ".pdf" dit is voor tabbladnaam erbij te geven
PdfFile = PdfFile & " " & ActiveSheet.Name & ".pdf" ' hiermee wordt de change notice naam in bestand opgenomen
' Export activesheet as PDF
With ActiveSheet
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=PdfFile, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
' Use already open Outlook if possible
On Error Resume Next
Set OutlApp = GetObject(, "Outlook.Application")
If Err Then
Set OutlApp = CreateObject("Outlook.Application")
IsCreated = True
End If
OutlApp.Visible = True
On Error GoTo 0
' Prepare e-mail with PDF attachment
With OutlApp.CreateItem(0)
' Prepare e-mail
.Subject = "Example"
.To = "[EMAIL="test@test.com"]test@test.com[/EMAIL]" ' <-- Put email of the recipient here
.CC = "[EMAIL="CCtest@test.com"]CCtest@test.com[/EMAIL]"
.Body = "Testing"
.Sensitivity = 3
.Attachments.Add PdfFile
.Display
End With
Kill (PdfFile)
End Sub