Known issues: 1. Error where variable is not defined. Suggestion: Delete the newly created blank sheet, save your workbook, close and reopen it. Then, run the code again. If the error persists, add 'ws.Select' before 'ws.Paste' and check the second point. 2. PDF file gets corrupted when opened. Suggestion: Add the parameter 'ActivePrinter:="Microsoft Print to PDF"' before 'PrToFileName' so that Excel will convert the file to PDF for you. Hope you find this information useful. Thanks for watching and have a wonderful day!
@Elizabeth-qp3ujАй бұрын
Thanks for this quick & easy manner macro. If you could help me with a current issue: Sometimes, not always, the screenshot is not of the Userform, but rather something else on the PC screen. This happens only to the users running Windows 11, not an issue with those of us using Windows 10. I added a loop of 10 'DoEvents' and now the occurrence happens less often, but I really need it to not ever grab the wrong screenshot. Is there anything else to do to ensure the focus is on the Userform? Thank you!
@ahsing_excel_VBAАй бұрын
My pleasure. Regarding your issue, I'm not sure if you can try the 'SetFocus' method. Setting focus on any control on the UserForm may help the macro better detect the desired window. I hope this helps. Thanks for watching, and I wish you a wonderful day!
@Elizabeth-qp3ujАй бұрын
@@ahsing_excel_VBA Thank you, that's an easy fix and great idea. Thank you for your help. May your day be wonderful too.
@Elizabeth-qp3ujАй бұрын
Shame, I had to drop this macro from my process since I couldn't get it to consistently screenshot the worksheet. I thought SetFocus would work, but it didn't. I added in loops of DoEvents and still had issues. My users were unhappy and I was frustrated putting out fires. Worked well on my Windows 10 PC, but inconsistent on Windows 11.
@mazenzagha881111 ай бұрын
Thanks again and again sir sir you are gentle 😊😊😊😊😊😊❤❤❤❤❤
@ahsing_excel_VBA11 ай бұрын
My pleasure 😉 Glad you like it. Thanks for watching and have a nice day.
@mazenzagha881111 ай бұрын
sir i have a massage when i run the program " the massage is acrobat reader could not open the file ,because either note supported type or beacause the file damaged ( it was sent as e-mailattached ,and was not correctly decoded " pls sir how solve this matter @@ahsing_excel_VBA
@ahsing_excel_VBA11 ай бұрын
Hi. May I know if the problem arises during runtime or when you open the file? It seems like the file format is incorrect.
@mazenzagha881111 ай бұрын
@@ahsing_excel_VBA sir thank you for replying me . Sir could you please send your email to send you the file to check it.seince i try many times and couldn't.pls sir
@mazenzagha881111 ай бұрын
@@ahsing_excel_VBA sir when i open the file pdf
@phole75918 ай бұрын
I following your coding but when I click on the newly created PDF, got an error "Not supported file type or damage .. not decode correctly". Can you help and give some pointers ? Thanks
@ahsing_excel_VBA8 ай бұрын
Hi. Your situation resembles Mazen's. It's likely due to the PDF opener. My suggestions were: 1. Ignore the very first error and rerun the macro again. 2. Try attempt to open the file using Microsoft Edge. 3. Alternatively, you might want to consider his solution, which involved converting the sheet to a PNG file instead of PDF. You can find more details in this video: kzbin.info/www/bejne/b6LXnWp3gZ6Sfa8. Additionally, if you'd like me to gain a better understanding of your issue, consider recording your screen from start to finish and sending it to me via Gmail or Facebook private message. Hope one of them help. Thanks for watching and have a nice day.
@nachiketbhale61504 ай бұрын
i copied as it is VBA code but when i run the same , getting error as Variable not defined
@ahsing_excel_VBA4 ай бұрын
Hi, you can add a line to define the variable first.
@nachiketbhale61504 ай бұрын
I tried to add as Dim WS as Worksheet Is it correct?
@nachiketbhale61504 ай бұрын
@@ahsing_excel_VBA What line i need to add as variable, Can you provide me the line , It will help me
@ahsing_excel_VBA4 ай бұрын
yup. It is correct.
@nachiketbhale61504 ай бұрын
i am getting error WS variable not defined - any one can help me
@ahsing_excel_VBA4 ай бұрын
Did you notice a new worksheet was added? If so, delete the new worksheet and run it again. It should be fine then.
@nachiketbhale61504 ай бұрын
Yes every time new worksheet is getting created as blank