I am having trouble finding a stable selector when printing excel sheet to pdf. I previously was able to use both a click image and a click button task to perform it. However with the new Microsoft 365 update I have been unable to perform. Has anybody run into a similar issue, or have an alternative suggestion?
@cdoughty Welcome to the community!
When you say print what do you mean? Print to a printer? Write to a PDF? Save as a PDF?
Using hotkey doesn’t help you?
@Jarzzz, yes print to pdf and save. The sheet is a template that runs data out of a matrix, and will be done a couple hundred times.
@KMota, so that is another curious issue I’m running into. I use hotkey to prompt the print itself, and that works fine. However once the print window is brought up, sending hotkey to hit “enter” on the window is not working either.
I also faced a problem similar to using the shortcut key enter, had to change to click, was not going at all
@cdoughty Try the below.
> Send Hotkey - Alt & FP > Send Hoteky - I > Click - Microsoft Print to PDF > Click - Print > Type - "File name" > Click - Save > Selector for the Microsoft Print to PDF below. Change title = 'Book1' > <wnd app='excel.exe' title='Book1 - Excel' /> > <ctrl name='Microsoft Print to PDF' role='list item' />
@Jarzzz it was not picking up on the selector even though it can identify and highlight it…was able to adjust the element and use a wildcard in place of the file name, seems like it did the trick.
Jarzzz sequence, though clear, did not work smoothly in my case. I realized when sending hotkey ‘i’, i should indicate the selector for the activity as the Print area, otherwise, the key input fails to register in excel. This resulted in the dropdown being visible. Then comes the challenging part on how to record the selector for the dropdown because as soon as you click outside the dropdown, it collapses!
To navigate this tricky part follow the following steps below:
- Click on ‘indicate on screen’ in your activity
- While the cursor highlights the different selectors on your screen use the shortcut key Alt+i to make the dropdown visible
- Now click the item you want to select off the dropdown list
UIPath should now have recorded the selector correctly.
Take a look …
Did you try to run a VBA code on the worksheet?
By doing this, you can also define more parameters and the file path can be passed as an argument:
My below function prints a range in PDF:
Function SaveRangeAsPDF(rng As Range, filePath As String) rng.ExportAsFixedFormat Type:=xlTypePDF, filename:=filePath, Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False End Function