Bekijk de onderstaande video om te zien hoe je onze site als een web app op je startscherm installeert.
Opmerking: Deze functie is mogelijk niet beschikbaar in sommige browsers.
Privacywetgeving
Het is bij Helpmij.nl niet toegestaan om persoonsgegevens in een voorbeeld te plaatsen. Alle voorbeelden die persoonsgegevens bevatten zullen zonder opgaaf van reden verwijderd worden. In de vraag zal specifiek vermeld moeten worden dat het om fictieve namen gaat.
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
sPad & Bestandsnaam, _
Quality:=xlQualityStandard, IncludeDocProperties:=False, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
Password:="", WriteResPassword:="",
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim fTemp As String
Dim oPdf As String
Dim Pwd As String
On Error GoTo OOPS:
fTemp = ThisWorkbook.Path & "\" & "Temp.Pdf"
oPdf = "[COLOR="#FF0000"]C:\Users\Grote\Downloads\Beveiliging\PDF met paswoord.Pdf[/COLOR]"
Pwd = "[COLOR="#FF0000"]test[/COLOR]"
With ActiveSheet
.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=fTemp, _
Quality:=xlQualityStandard
End With
fTemp = """" & fTemp & """"
oPdf = """" & oPdf & """"
Pwd = """" & Pwd & """"
cmdStr = "pdftk " & fTemp _
& " Output " & oPdf _
& " User_pw " & Pwd _
& " Allow AllFeatures"
Shell cmdStr, vbHide
Application.Wait DateAdd("s", 2, Now)
Kill Replace(fTemp, """", "")
Application.ScreenUpdating = True
Application.DisplayAlerts = True
MsgBox "Bestand is opgeslagen", vbInformation
Exit Sub
OOPS:
MsgBox "PDF bestaat al.", vbCritical
End Sub
De Password opties die je noemt staan er niet bij:
https://msdn.microsoft.com/en-us/library/office/ff198122.aspx
Hoi,
Ik heb een code die het doet voor mij maar je hebt PDFtk Toolkit nodig (gratis)
Downloadlink:
https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
Stap 1: installeer PDFtk Toolkit
Stap 2: Plaats volgende code onder een knopje
Pas de rode stukken aanCode:Private Sub CommandButton1_Click() Application.ScreenUpdating = False Application.DisplayAlerts = False Dim fTemp As String Dim oPdf As String Dim Pwd As String On Error GoTo OOPS: fTemp = ThisWorkbook.Path & "\" & "Temp.Pdf" oPdf = "[COLOR="#FF0000"]C:\Users\Grote\Downloads\Beveiliging\PDF met paswoord.Pdf[/COLOR]" Pwd = "[COLOR="#FF0000"]test[/COLOR]" With ActiveSheet .ExportAsFixedFormat Type:=xlTypePDF, _ Filename:=fTemp, _ Quality:=xlQualityStandard End With fTemp = """" & fTemp & """" oPdf = """" & oPdf & """" Pwd = """" & Pwd & """" cmdStr = "pdftk " & fTemp _ & " Output " & oPdf _ & " User_pw " & Pwd _ & " Allow AllFeatures" Shell cmdStr, vbHide Application.Wait DateAdd("s", 2, Now) Kill Replace(fTemp, """", "") Application.ScreenUpdating = True Application.DisplayAlerts = True MsgBox "Bestand is opgeslagen", vbInformation Exit Sub OOPS: MsgBox "PDF bestaat al.", vbCritical End Sub
Hier in bijlage een werkend voorbeeldje (als PDFtk Toolkit is geïnstaleerd,en path is aangepast)
Paswoord is test
We gebruiken essentiële cookies om deze site te laten werken, en optionele cookies om de ervaring te verbeteren.