Hi,
I've got a 2-page report that I want to be able to save multiple versions of, in the same PDF. By 'versions' I mean with changed values based on user selection from a drop-down list (in cell B4)
I've got the code below to generate a PDF, but what I'd really like to have happen is that the user can save - in a single PDF - all the versions of the report, as if she had selected them one-by one from the drop-down list, and then run the macro for each and saved them one at a time. The drop-down list is an array of variable length defined as "VersionList"
Your help/tips/advice greatly appreciated.
I've got a 2-page report that I want to be able to save multiple versions of, in the same PDF. By 'versions' I mean with changed values based on user selection from a drop-down list (in cell B4)
I've got the code below to generate a PDF, but what I'd really like to have happen is that the user can save - in a single PDF - all the versions of the report, as if she had selected them one-by one from the drop-down list, and then run the macro for each and saved them one at a time. The drop-down list is an array of variable length defined as "VersionList"
Code:
[COLOR=#E56717][FONT=Consolas][B]Sub[/B][/FONT][/COLOR][COLOR=#141414][FONT=Consolas] SaveThisOneAsPDF()[/FONT][/COLOR]
[COLOR=#8D38C9][FONT=Consolas][B]With[/B][/FONT][/COLOR][COLOR=#141414][FONT=Consolas] Application.FileDialog(msoFileDialogFolderPicker) [/FONT][/COLOR][COLOR=#008000][FONT=Consolas]' Select folder only - user won't have control over filename
[/FONT][/COLOR][COLOR=#141414][FONT=Consolas] .Title = [/FONT][/COLOR][COLOR=#800000][FONT=Consolas]"Select where to save"[/FONT][/COLOR]
[COLOR=#141414][FONT=Consolas] .ButtonName = [/FONT][/COLOR][COLOR=#800000][FONT=Consolas]"Use this folder"[/FONT][/COLOR][COLOR=#008000][FONT=Consolas]' instead of 'OK' button
[/FONT][/COLOR][COLOR=#141414][FONT=Consolas] .AllowMultiSelect = [/FONT][/COLOR][COLOR=#00C2FF][FONT=Consolas][B]False[/B][/FONT][/COLOR]
[COLOR=#141414][FONT=Consolas] .Show[/FONT][/COLOR]
[COLOR=#8D38C9][FONT=Consolas][B]If[/B][/FONT][/COLOR][COLOR=#141414][FONT=Consolas] .SelectedItems.Count <> 0 [/FONT][/COLOR][COLOR=#8D38C9][FONT=Consolas][B]Then[/B][/FONT][/COLOR]
[COLOR=#141414][FONT=Consolas] Sheet1.Range([/FONT][/COLOR][COLOR=#800000][FONT=Consolas]"i6"[/FONT][/COLOR][COLOR=#141414][FONT=Consolas]) = .SelectedItems(1)[/FONT][/COLOR]
[COLOR=#8D38C9][FONT=Consolas][B]Else[/B][/FONT][/COLOR][COLOR=#008000][FONT=Consolas]'If user cancels
[/FONT][/COLOR][COLOR=#141414][FONT=Consolas] MsgBox [/FONT][/COLOR][COLOR=#800000][FONT=Consolas]"Not Saved"[/FONT][/COLOR][COLOR=#141414][FONT=Consolas], vbExclamation, [/FONT][/COLOR][COLOR=#800000][FONT=Consolas]"FYI:"[/FONT][/COLOR]
[COLOR=#E56717][FONT=Consolas][B]Exit[/B][/FONT][/COLOR][COLOR=#E56717][FONT=Consolas][B]Sub[/B][/FONT][/COLOR]
[COLOR=#8D38C9][FONT=Consolas][B]End[/B][/FONT][/COLOR][COLOR=#8D38C9][FONT=Consolas][B]If[/B][/FONT][/COLOR]
[COLOR=#8D38C9][FONT=Consolas][B]End[/B][/FONT][/COLOR][COLOR=#8D38C9][FONT=Consolas][B]With[/B][/FONT][/COLOR]
[COLOR=#141414][FONT=Consolas] ActiveSheet.ExportAsFixedFormat _[/FONT][/COLOR]
[COLOR=#151B8D][FONT=Consolas][B]Type[/B][/FONT][/COLOR][COLOR=#141414][FONT=Consolas]:=xlTypePDF, _[/FONT][/COLOR]
[COLOR=#141414][FONT=Consolas] Filename:=Range([/FONT][/COLOR][COLOR=#800000][FONT=Consolas]"I7"[/FONT][/COLOR][COLOR=#141414][FONT=Consolas]), _[/FONT][/COLOR]
[COLOR=#141414][FONT=Consolas] Quality:=xlQualityStandard, _[/FONT][/COLOR]
[COLOR=#141414][FONT=Consolas] IncludeDocProperties:=[/FONT][/COLOR][COLOR=#00C2FF][FONT=Consolas][B]True[/B][/FONT][/COLOR][COLOR=#141414][FONT=Consolas], _[/FONT][/COLOR]
[COLOR=#141414][FONT=Consolas] IgnorePrintAreas:=[/FONT][/COLOR][COLOR=#00C2FF][FONT=Consolas][B]False[/B][/FONT][/COLOR][COLOR=#141414][FONT=Consolas], _[/FONT][/COLOR]
[COLOR=#141414][FONT=Consolas] OpenAfterPublish:=[/FONT][/COLOR][COLOR=#00C2FF][FONT=Consolas][B]True[/B][/FONT][/COLOR]
[COLOR=#8D38C9][FONT=Consolas][B]End[/B][/FONT][/COLOR][COLOR=#E56717][FONT=Consolas][B]Sub[/B][/FONT][/COLOR]
[COLOR=#E56717][FONT=Consolas][B]Sub[/B][/FONT][/COLOR][COLOR=#141414][FONT=Consolas] SaveAlltoPDF()[/FONT][/COLOR]
[COLOR=#141414][FONT=Consolas]MsgBox ([/FONT][/COLOR][COLOR=#800000][FONT=Consolas]"Still working out how to do it!"[/FONT][/COLOR][COLOR=#141414][FONT=Consolas])[/FONT][/COLOR]
[COLOR=#8D38C9][FONT=Consolas][B]End[/B][/FONT][/COLOR][COLOR=#E56717][FONT=Consolas][B]Sub[/B][/FONT][/COLOR]
Your help/tips/advice greatly appreciated.