PDA

View Full Version : Create Bookmarks from cell names when saving as pdf



MD1907
09-26-2019, 02:48 PM
I want to use cell names or names of named ranges as bookmarks. When I save as pdf I need these bookmarks to carry over to the pdf document.
Is there a macro that can do this? Excel 365 with Adobe add-in. Adobe creates bookmark from Worksheet names ok but need it (or Excel) to create bookmarks from e.g. cell names and if possible hierarchical / tree menu as it does easily when creating pdfs from e.g. Word documents. Single Excel sheet I convert is saved as 60 pages, need these bookmarked for presentation as pdf.

SamT
09-27-2019, 10:55 AM
Worksheet.Names = A Collection of all Named Ranges and Formulas on that worksheet
Workbook.Names = A Collection of all Named Ranges and Formulas in that Workbook


dim Nme as Name
For Each Nme in myWorksheet.Names
If not Intersect(Nme.RefersToRange, myRange) Is Nothing then
'Yes, that is the right Name
Bookmark = Nme.name
Exit for
End If
Next

MD1907
09-27-2019, 02:25 PM
Thanks very much for the reply. Please bear with me, I like messing with Excel but can only dabble in VBA code:wot.
Maybe I'm meant to add something specific for my specific workbook?
I get run time error '424' Object Required and debug opens up, stopped at second line of code.
I have a workbook called 'Report Template' containing 1 sheet called 'Report"
The worksheet is 3 pages long with 4 named cells that I want to appear as bookmarks in the bookmark tree menu of pdf file when sheet is saved as pdf.
(Original workbook is about 60 page worksheet but I've cut it down to 3 pages)
Thanks again!