+ Reply to Thread
Results 1 to 8 of 8

Saving as pdf in the same location with the same file name

  1. #1
    Registered User
    Join Date
    04-30-2024
    Location
    london
    MS-Off Ver
    365
    Posts
    4

    Saving as pdf in the same location with the same file name

    Hello,
    I need to make a macro that would save an opened excel file to the same location and the same file name, just as pdf (if it would "save" the original file and closed the workbook as well, that'd be a bonus! ).
    How do I do it?
    I recorded my macro (save as pdf), and tried to use ThisWorkbook.Path & ActiveWorkbook.Name , but I can't get it to work (I have never used VBA before, so I have no idea what I'm doing)
    Help please ?

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,446

    Re: Saving as pdf in the same location with the same file name

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,964

    Re: Saving as pdf in the same location with the same file name

    save an opened excel file to the same location and the same file name, just as pdf (if it would "save" the original file and closed the workbook as well, that'd be a bonus! ).
    Please Login or Register  to view this content.
    Last edited by Sintek; 04-30-2024 at 03:28 AM.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  4. #4
    Registered User
    Join Date
    04-30-2024
    Location
    london
    MS-Off Ver
    365
    Posts
    4

    Re: Saving as pdf in the same location with the same file name

    Thank you so much. Works a charm!
    That's amazing.
    Is there a way to stop a "file has changed , are you sure you want to save" prompt to say yes automatically ?
    If not, that's still absolutely amazing, thank you!

  5. #5
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,964

    Re: Saving as pdf in the same location with the same file name

    Is there a way to stop a "file has changed , are you sure you want to save" prompt to say yes automatically ?
    Can you elaborate on this...Don't quite understand...

  6. #6
    Registered User
    Join Date
    04-30-2024
    Location
    london
    MS-Off Ver
    365
    Posts
    4

    Re: Saving as pdf in the same location with the same file name

    I do apologise.
    If I open a file (excel) and change something in it, and then use your macro it saves pdf, and closes an excel file. I'll get a prompt "want to save your changes to..."

    Attachment 867804

    Is there any way to automatically say "save" in the macro
    (I'm really sorry to bother you with that, it's really not a big deal I can really live with that, but I'm curious..)

  7. #7
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,964

    Re: Saving as pdf in the same location with the same file name

    No need to...Just add red snippet...

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    04-30-2024
    Location
    london
    MS-Off Ver
    365
    Posts
    4

    Re: Saving as pdf in the same location with the same file name

    :D So simple. Amazing! Thank you so much once more !

+ 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. VBA - Saving to file location via cell value
    By Josephrandall in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-09-2022, 07:01 PM
  2. [SOLVED] Help with VBA to automate saving file in specific location and file name with dates
    By fornight in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-10-2017, 08:07 AM
  3. saving a file in a remote location
    By santhoshkuttan in forum Excel General
    Replies: 7
    Last Post: 11-08-2016, 12:44 PM
  4. [SOLVED] Saving file in a date specific location
    By mayurpatil in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-15-2013, 01:30 AM
  5. [SOLVED] saving file name and location with excel macro
    By Alex Suardi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-02-2005, 06:20 PM
  6. [SOLVED] saving file name and location with excel macro
    By Alex Suardi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-02-2005, 06:17 PM
  7. VBA for saving a file to a specific location
    By TimT in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-07-2005, 04:05 PM

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