Hallo,
Ik heb een macro waarbij ik een Excel sheet wil opslaan als PDF, maar ik wil de pdf graag opslaan zonder de value die in een bepaalde cel staan:
Dus als voorbeeld: in de excel en CEL "A1" staat €9,00 dan moet hij wanneer de sheet wordt opgeslagen als PDF de gegevens van CEL "A1" leeglaten / weglaten
Is dat mogelijk?
Ik heb een macro waarbij ik een Excel sheet wil opslaan als PDF, maar ik wil de pdf graag opslaan zonder de value die in een bepaalde cel staan:
Dus als voorbeeld: in de excel en CEL "A1" staat €9,00 dan moet hij wanneer de sheet wordt opgeslagen als PDF de gegevens van CEL "A1" leeglaten / weglaten
Code:
Sub CHCopySpecToNewPDF()
Dim wsA As Worksheet
Dim wbA As Workbook
Dim EAN As String
Dim SAP As String
Dim ArticleName As String
Dim PERIOD As String
On Error GoTo errHandler
Set wbA = ActiveWorkbook
Set wsA = ActiveSheet
strTime = Format(Now(), "yyyymmdd\_hhmm")
EAN = Range("B10")
SAP = Range("B9")
NAME = Range("B5")
PERIOD = Range("B7")
'get active workbook folder, if saved
strPath = "S:\"
If strPath = "" Then
strPath = Application.DefaultFilePath
End If
strPath = strPath & "\"
'replace spaces and periods in sheet name
strName = Replace(wsA.NAME, " ", "")
strName = Replace(strName, ".", "_")
'create default name for savng file
strFile = EAN & "_" & SAP & "_" & NAME & "_" & PERIOD & ".pdf"
strPathFile = strPath & strFile
'use can enter name and
' select folder for file
myFile = Application.GetSaveAsFilename _
(initialFilename:=strPathFile, _
FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and FileName to save")
'export to PDF if a folder was selected
If myFile <> "False" Then
wsA.ExportAsFixedFormat _
Type:=xlTypePDF, _
filename:=myFile, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
'confirmation message with file info
MsgBox "PDF file has been created: " _
& vbCrLf _
& myFile
End If
exitHandler:
Exit Sub
errHandler:
MsgBox "Could not create PDF file"
Resume exitHandler
End Sub
Is dat mogelijk?