I am creating a process using VBA code, via a Microsoft 2013 Access database, to loop through Pages of a 2013/2016 OneNote notebooks, to print the Section’s Pages to pdf files.
I am using the Publish Method (oneNote.Publish pageID, publishContentTo, pfPDF) to print each Section Page, which requires only a single Page ID as the method’s first variable, thus only printing one Section Page per pdf file, whether it be a Page or Subpage.
The code works; however, I need to print the Sub Pages into the same pdf file of its Parent Page.
I know that OneNote has the functionality. If you click File, Print, then Print Preview, the user interface will bring up the Print Preview & Settings Dialog box. In that box, under Settings, there is a dropdown to pick a Print Range. When I select the Page Group range, and print the file, it includes the subpages along with the Parent Page.
Is there a VBA function to mimic printing of the Page Group range, or is there a way using the current Publish Method or any other VBA coding functions or methods?
This is the first time I am coding with OneNote and I am not finding many OneNote/VBA examples.
Related
We have a process where the user saves an email as a .pdf file. I have developed a script that pulls the information for the filename from the email and prompts the user for additional necessary information.
What I can't figure out is how to then have my VBA script select the appropriate Acrobat command in the Ribbon or right-click menu. I've tried executemso, but the msoid is a non-specific "CustomControl". Specifically, the Acrobat add-in adds another tab to the Ribbon called "Acrobat" which then has the option Selected Messages (dropdown) with Create New PDF. Typically, my users just right click the email and choose "Convert to Adobe PDF". A third option would be to programmatically select File | Save as Adobe PDF.
So ideally a user could select an email message and run my VBA macro and that macro would then continue the process to the convert to pdf. Another thought I've had is to somehow watch for the event of creating a pdf and to run the macro and copy the programmatically-created filename to the clipboard.
There is no trivial way to execute custom ribbon controls from other add-ins. You may consider contacting add-in developers for any public API in the add-in which you could call directly. Also you may take a look at the Accessibility API.
Instead, you can try using the Word object model for saving email as a PDF file on the disk. The Inspector.WordEditor property returns the Microsoft Word Document Object Model of the message being displayed. The Document.ExportAsFixedFormat2 method allows saving a document which represents the message body in PDF or XPS format.
I've been working on a Word macro that includes a step allowing the user to select and insert a Visio file into the active Word document. Since many of the source Visio files are multipaged, and the specific Visio drawing to place in Word could be on any page of the Visio document, I need a way to allow the user to select the page they want to place.
Currently, my VBA code uses Appplication.FileDialog(msoFileDialogFilePicker) to set a variable for the Visio drawing's filepath (myVisioPath), then creates a variable for the Visio file and inserts it it into the Word doc as follows:
Dim myViz As InlineShape
Set myViz = ActiveDocument.InlineShapes.AddOLEObject(ClassType:="Visio.Drawing.15", FileName:=myVisioPath, LinkToFile:=False, DisplayAsIcon:=False, Range:=Selection.Range)
myViz.Select `Selects the Visio for subsequent actions`
The current working version of the macro selects whatever is on page 1 of the selected Visio file. I need a way to allow the user to select page 2, or page 3, or whatever page the target drawing is on in the Visio file. Currently, I'm thinking of creating a userform to allow choosing a page number, but I'm open to suggestions.
The post by Mathieu Guindon led me to the answer (would have voted it as the answer but that doesn't appear to be an option). Anyway, the code posted at Choose active page in Visio provided the basis of my solution. Set a variable for the Visio.Application object and refer to it to get both the page count of the user-selected Visio file (for error trapping if the user selects a page number that isn't available in the file) and to copy the user-selected page.
Using Google Sheets and working on a script to make exporting (downloading) a PDF copy of a single sheet much easier. The end goal is to emulate the Download as... PDF, but click of a button and it's done, without having to go to the menu. Also uses a custom file name (which includes the date and time).
The question...
When exporting a sheet using a script, is there a way to customize the content of the headers? I know when doing it manually, I can customize what appears in the headers and footers, but what about a script to change the top (or bottom) left/center/right areas when exporting a PDF via script? I know I can optionally enable a title (printtitle=true) or sheet name (sheetnames=true), but I can't find anything to permit me to customize what appears.
What I would like is to have a custom name/string for the top left and top center, then the date and time in the top right.
I have an existing PDF template, and I want to add some text over the top of it in a specific location on a specific page. For example, an invoice template or a scanned document.
How would I go about this? I'm using Sheets if that narrows my options.
There is a lot of documentation on how to create PDFs from documents, but nothing that will take a particular PDF and put text over it.
A bit of blue sky thinking from my side. What if you were to do the following?
Manually:
Export the PDF as an image
Resize a Google slide to be the same shape as the image
Add the image to the google slide as a background image
In Code:
Make a copy of the google slide as needed
Add your Google sheets data to the slide positioned as needed on the slide
Export the Google slide as a pdf
I mention google slides, because Google docs to not have allow background images.
Another possibility with using Google docs is to build a document that looks like your invoice, then add to it tags. In your code search for the tags and replace them with data from your sheet. Even you could use a mail merge addon to do this if you didn't fancy writing any code.
In your Google Drive right-click on your PDF;
Open With > Connect More Apps > Search docusign > Left-click blue connect button and this should take you to Docusign.
Your PDF will then open with Docusign where you can manually add a signature or text to specific places.
Alternatively... You can use App Script.
Example,
Constructing a document using HTML and replacing the specific value with a variable which is collect from a Sheet or particular location. Writing the function to do this will allow you to interpret the HTML and replace the variable with the text or possibly an image. Then it would create this as a PDF.
There are many alternative ways to do this.
Here is one example on github;
Convert Google Doc to PDF using App Script
I have a PowerPoint 2010 file saved as a PowerPoint Macro-enabled show (.ppsm) file. I have a hyperlink on a particular page of the PPSM and I've linked it to a PDF file. Great, it all works.
Now I need to put a hyperlink in the PDF file that will jump me back to the specific page in the PPSM, but I can't seem to figure out how to do it. The information in another thread says to add "#15" (the page number) to the filename, but the link seems to put the entire file path. I also get an error that this is not a valid file name. I want to be able to just store the files together in the same directory and have them find each other with the file name, not the whole path.
All assistance gratefully accepted.
If you're running the slide show and link to a PDF file, the show is still running and sitting on the slide you linked from.
All you need to add to the PDF is a link that closes the PDF or possibly quits Acrobat/Reader altogether.
Open the PDF in Acrobat, add a link, choose Custom Link, click Next.
In Link Properties dialog box, go to the Actions tab
Select Action: Execute a menu item.
Click Add to get a list of available menu items, choose File, Close
or File, Exit.
If you need to return to some other page than the one you started on in PPT, it gets a bit trickier.