Export to pdf in combination with Sharepoint read only access

Sapron75

New Member
Joined
Jun 6, 2016
Messages
15
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


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
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,215,315
Messages
6,124,207
Members
449,147
Latest member
sweetkt327

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top