Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-14-2020, 08:28 AM
NoSparks NoSparks is offline Macro to print to pdf files showing pupil names Windows 10 Macro to print to pdf files showing pupil names Office 2010
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

Care to show us your current macro ?
Reply With Quote
  #2  
Old 12-14-2020, 08:48 AM
Richystab Richystab is offline Macro to print to pdf files showing pupil names Windows 10 Macro to print to pdf files showing pupil names Office 2019
Novice
Macro to print to pdf files showing pupil names
 
Join Date: Dec 2020
Posts: 12
Richystab is on a distinguished road
Default Current macro

Code:
Sub CombinedScienceExport()
Dim FolderName As String, fName As String
Dim inputRange As Range, r As Range, c As Range

Application.ScreenUpdating = False
'''' Open file dialog and choose folder
With Application.FileDialog(msoFileDialogFolderPicker)
    .AllowMultiSelect = False
    If .Show = True Then
        FolderName = .SelectedItems(1) & ""
    Else
        Exit Sub
    End If
End With

'''' Location of DataValidation cell
Set r = Worksheets("Student Report Combined Science").Range("S2")
'''' Get DataValidation values
Set inputRange = Evaluate(r.Validation.Formula1)

'''' Loop through DataValidation list
For Each c In inputRange
    r.Value = c.Value
    fName = c.Value
    '''' Save as pdf
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=FolderName & fName, _
        Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Next c
Application.ScreenUpdating = True
End Sub

Last edited by macropod; 12-14-2020 at 02:53 PM. Reason: Added code tags
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to print to pdf files showing pupil names Footers not showing in print preview nor will they print Lee_Lee Word 3 09-19-2017 05:06 AM
Macro to print to pdf files showing pupil names How do I import list of names from excel to print placecards? jrawls Word 2 08-17-2017 06:53 AM
Why 'print forms data' print pictures for DOCX files koolprasad2003 Word 4 05-09-2014 03:26 PM
Macro to print to pdf files showing pupil names VBA: How to debug.Print enumeration names? tinfanide Word VBA 4 01-27-2012 01:41 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:17 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft