Ok probeer dit
De data validatie cell is in Sheet1 in D3 in dit voorbeeld
de data voor de validatie cel staat in Sheet2 in A1:A10
Verander ook het path in de TempFileName
C:\Users\Ron\test\
Sub test()
Dim TempFileName As String
Dim Num As Long
Num = 0
For Each cell In Sheets("Sheet2").Range("A1:A10").SpecialCells(xlCellTypeConstants)
Num = Num + 1
Sheets(1).Range("D3").Value = cell.Value
Sheets(1).Calculate
TempFileName = "C:\Users\Ron\test" & Num & ".pdf"
RDB_Create_PDF ActiveSheet, TempFileName, True, False
Next cell
End Sub
Function RDB_Create_PDF(Myvar As Object, FixedFilePathName As String, _
OverwriteIfFileExist As Boolean, OpenPDFAfterPublish As Boolean) As String
Dim FileFormatstr As String
Dim Fname As Variant
'Test If the Microsoft Add-in is installed
If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _
& Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") <> "" Then
If FixedFilePathName = "" Then
'Open the GetSaveAsFilename dialog to enter a file name for the pdf
FileFormatstr = "PDF Files (*.pdf), *.pdf"
Fname = Application.GetSaveAsFilename("", filefilter:=FileFormatstr, _
Title:="Create PDF")
'If you cancel this dialog Exit the function
If Fname = False Then Exit Function
Else
Fname = FixedFilePathName
End If
'If OverwriteIfFileExist = False we test if the PDF
'already exist in the folder and Exit the function if that is True
If OverwriteIfFileExist = False Then
If Dir(Fname) <> "" Then Exit Function
End If
'Now the file name is correct we Publish to PDF
On Error Resume Next
Myvar.ExportAsFixedFormat _
Type:=xlTypePDF, _
FileName:=Fname, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=OpenPDFAfterPublish
On Error GoTo 0
'If Publish is Ok the function will return the file name
If Dir(Fname) <> "" Then RDB_Create_PDF = Fname
End If
End Function
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
"lvl2" wrote in message news:*** E-mailadres is om privacyredenen verwijderd ***...
Hoi Ron,
de data van de lijst (op tabblad 1) komen van een benoemde range op een ander tabblad(tabblad 2). De andere gegeven op het bedoelde tabblad (tabblad 1) veranderen met gegevens van nog een ander tabblad (tabblad 3). Kan je nog volgen? :-)
Groetjes,
lvl2