I want to set all the named range in one variable and export to PDF. I am able to do when I manually enter all the named range. My problem is named range are variable, sometime it will have one some time it will have more than 10. Please advice...I tried with following codes.
Dim wbBook As Workbook
Dim nName As Name
Set wbBook = ActiveWorkbook
Set nName=wbBook.Names
Set rs = wbBook.Range(nNames)
rs.Select
Selection.ExportAsFixedFormat xlTypePDF, strPath, , , False
But below code works for me, when I enter range name manually..
Set rs = wbBook.Range("Page_1,Page_2,Page_3")
rs.Select
Selection.ExportAsFixedFormat xlTypePDF, strPath, , , False
Dim nName As Namebut in your line you haveSet rs = wbBook.Range(nNames), nNames instead of nNameSet rs = wbBook.Range("Page_1,Page_2,Page_3")works?