+ Reply to Thread
Results 1 to 6 of 6

Print to PDF - Error Read Only

  1. #1
    Registered User
    Join Date
    09-16-2018
    Location
    Washington State, USA
    MS-Off Ver
    2016
    Posts
    43

    Print to PDF - Error Read Only

    Below is some code to print the active sheet to a PDF, works great. The issue is if the user leaves the PDF viewer open and clicks to print again I get an error, see below. Can anyone help with stopping the macro from running to prevent an accidental error?

    Capture.PNG

    Please Login or Register  to view this content.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Print to PDF - Error Read Only

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    09-16-2018
    Location
    Washington State, USA
    MS-Off Ver
    2016
    Posts
    43

    Re: Print to PDF - Error Read Only

    I am fairly new to VBA, inserted the code and can tell it works great. From the way its acting I am guessing its inserted in the wrong spot. Can you combine it all so I can copy and insert?

  4. #4
    Registered User
    Join Date
    09-16-2018
    Location
    Washington State, USA
    MS-Off Ver
    2016
    Posts
    43

    Re: Print to PDF - Error Read Only

    Think I got it, seems to be working well!

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-16-2018
    Location
    Washington State, USA
    MS-Off Ver
    2016
    Posts
    43

    Re: Print to PDF - Error Read Only

    Follow up question on this. Code works well, except if you have your PDF program open it will not print without closing it. Example would be if I have another pdf open and viewing, try to print with this macro it throws the error msgbox. Can that we corrected?

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Print to PDF - Error Read Only

    You can't overwrite an open file.

    EDIT: That's not strictly true; I think you could overwrite a file open in Notepad. But most applications lock files when opening them.
    Last edited by shg; 10-14-2018 at 04:28 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Read error
    By mikla90 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2018, 01:05 PM
  2. Print Macro errors on final print command. Run-time error '1004':
    By Steverizer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-05-2013, 06:41 PM
  3. A loop to read one cell and print to another
    By maruchi in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 07-19-2011, 02:23 PM
  4. Excel 2010 print/print preview error for combo boxes
    By dlmcdan in forum Excel General
    Replies: 3
    Last Post: 03-23-2011, 12:32 PM
  5. Replies: 2
    Last Post: 11-04-2005, 09:40 PM
  6. Replies: 0
    Last Post: 10-18-2005, 02:05 PM
  7. i want excel to read the amount (no. format-20,000.00) and print .
    By Rajiv Madan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-14-2005, 05:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1