+ Reply to Thread
Results 1 to 5 of 5

VBA: Print to PDF and Overwrite Existing file

  1. #1
    Registered User
    Join Date
    03-11-2020
    Location
    Melbourne, Australia
    MS-Off Ver
    2016
    Posts
    9

    VBA: Print to PDF and Overwrite Existing file

    Hi all

    Just a quick one (hopefully). Having trouble with establishing an overwrite protocol when saving something as PDf.

    The current code I am utilising is below, however it does not prompt to overwrite, instead not saving at all (I presume due to the error in the 4th line)
    Code is as follows:
    Please Login or Register  to view this content.
    Thank you in advance!

  2. #2
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: VBA: Print to PDF and Overwrite Existing file

    Hi, in the first place I would check if the file already exists, because as you said, no warning is given,
    secondly I would rewrite this, as this gives an error (you ruled that out in line 4):
    Please Login or Register  to view this content.
    into
    Please Login or Register  to view this content.
    Cheers
    Erwin
    I started learning VBA because I was lazy ...
    Still developing.... being more lazy...

  3. #3
    Registered User
    Join Date
    03-11-2020
    Location
    Melbourne, Australia
    MS-Off Ver
    2016
    Posts
    9

    Re: VBA: Print to PDF and Overwrite Existing file

    Gday Erwin

    Thanks for your reply mate, really do appreciate it.
    Great changes, I have now updated this!

    In respect to check if the file exists and overwrite it - any ideas?

  4. #4
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: VBA: Print to PDF and Overwrite Existing file

    Yes, you can add this into your code:
    Please Login or Register  to view this content.
    and below your macro:
    Please Login or Register  to view this content.
    Cheers
    Erwin

  5. #5
    Registered User
    Join Date
    03-11-2020
    Location
    Melbourne, Australia
    MS-Off Ver
    2016
    Posts
    9

    Re: VBA: Print to PDF and Overwrite Existing file

    Hi Eastwood,
    Just wanted to say a huge thank you for your assistance and coding.
    The code worked exactly as required; I simply changed a few things for my needs.

    Really do appreciate it

    cheers

+ 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. [SOLVED] Overwrite existing file
    By dekueb in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-17-2018, 03:12 PM
  2. overwrite existing file automaticly
    By hakunaberlin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-24-2016, 02:23 PM
  3. Need to Overwrite existing XML file - Error 58
    By VBABegin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-27-2016, 11:11 AM
  4. PDF Export with overwrite existing file prompt
    By Harribone in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-12-2015, 04:50 PM
  5. Save As-Overwrite existing File
    By loulorisgomez in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2012, 07:24 AM
  6. Prevent overwrite of existing file when saving as pdf
    By glenin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-16-2010, 06:04 PM
  7. Export And Overwrite Existing file
    By okelly in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-20-2007, 11:19 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