+ Reply to Thread
Results 1 to 23 of 23

Code: Save file in excel & Pdf at 2 different locations

  1. #1
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Code: Save file in excel & Pdf at 2 different locations

    Hi Folks,


    I am not good in coding and need your help in writing a code to solve my problem below.
    I have a form in excel for assessing community projects for approval. I am thinking that whenever someone wants to start a new project must submit this assessment form.
    When someone fill the form and click on save button it should save file name, picking from Cell C1, at 2 different locations in PDF & in excel. it should also clear the form and generating a new file# in C1 at the same time for next person to fill.

    Please find attached file.

    Once again thanks for help.


    Ray
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Code: Save file in excel & Pdf at 2 different locations

    I found the code below for saving in pdf and it saves as PDF with same file name....see attached updated file
    but I want to save in pdf and in excel both at 2 different locations (pdf at one location & excel at other location) with file name picking from Cell C1 and after saving it auto generate another file # in Cell C1 and clear the form for next person to fill.

    I really appreciate if you help me out.....

    Regards

    Ray
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Code: Save file in excel & Pdf at 2 different locations

    Try;

    Please Login or Register  to view this content.
    Please click the * Add Reputation if this helps
    If solved remember to mark Thread as solved

    "I'm glad to help and this is not meant to sound smart, but either you have super-human vision to see all those controls cleared one by one with the code I posted, or your computer is really slow."

  4. #4
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Code: Save file in excel & Pdf at 2 different locations

    Thanks Blokeman!

    I really appreciate your help and sparing your valuable time to write this code for me. It saves file in my document in both pdf and excel format. It solve my half problem. It will be great if you help me and write a code that save pdf file in my pdf folder and excel file in my excel folder at desktop.

    Regards

    Ray

  5. #5
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Code: Save file in excel & Pdf at 2 different locations

    Still waiting for some excel expert help........

  6. #6
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Code: Save file in excel & Pdf at 2 different locations

    Usually the folders on your desktop are shortcut, so you have to find where your folders are.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Code: Save file in excel & Pdf at 2 different locations

    Thanks Blokeman! I tried the above mentioned code but didn't work.
    Can you please double check for me?

    Thanks

  8. #8
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Code: Save file in excel & Pdf at 2 different locations

    As explained, you will need to insert the name of your folder. If it is a shortcut to a folder, it is another matter.

    If you know the foldername, just concatenate that name to this to get the full path to the folder on your desktop.
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Code: Save file in excel & Pdf at 2 different locations

    Let's assume that it wasn't a shortcut folder, change the username and the folder name(red color), I name my folders as Pdf and Excel in desktop. This is windows vista and 7.

    Please Login or Register  to view this content.
    Last edited by Blokeman; 01-30-2015 at 12:26 AM.

  10. #10
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Code: Save file in excel & Pdf at 2 different locations

    Hi Blokeman,

    It's nice to see you online. I tried to use your code but didn't work. I think i am making some mistake. Please find attached file and fix it for me.

    Thanks

    Ray
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Code: Save file in excel & Pdf at 2 different locations

    You have to change the username (your username) and the folder name (if you have different folder name). The code that I give it to you (post #9) is if you created the folder on the desktop (if there is no arrow on the folder).

  12. #12
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Code: Save file in excel & Pdf at 2 different locations

    Run this to get your username;
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Code: Save file in excel & Pdf at 2 different locations

    You are right. Thanks
    I really appreciate your help.

    Now when I save it saves in 2 different location (One in PDF and other in excel having name pick up from File # 25001) gr8

    Is it possible when I save it, it also clears the form and close it? But when I open again this(Book1) file, it open with new file # .

    Once again thanx for all your help. I hope you spare sometime and solve my next step.

    Regards

    Ray

  14. #14
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Code: Save file in excel & Pdf at 2 different locations

    When you open the file it will clear the form and C1 will increment the last number by 1.


    Made changes to code;

    Please Login or Register  to view this content.
    Paste this to ThisWorkBook;
    Please Login or Register  to view this content.
    Last edited by Blokeman; 02-05-2015 at 07:27 AM.

  15. #15
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Code: Save file in excel & Pdf at 2 different locations

    Wow Thanks Bolkeman! It's amazing how little codes work in an effecient way.
    It really work great but I think I forgot to tell you that saved file shouldn't lose data in it.


    Problem:
    When I open saved excel file in excel folder, it clears data and it also increament number in C1.

    It's great for my original project form to act like that.

    When I filled PROJECT FORM and saved -> It saved file in excel & pdf formats in 2 different location(gr8)
    When I opened Saved Excel PROJECT FORM with unique file # (C1) -> it acts same as my original form (clear and increament) I lost my project data


    What I want: when I open my saved excel file in excel folder, it should have same File # (C1) AND all data filled in it.

    My purpose is that whenever I filled the for new Project Form it should have unique file # (C1). And when I saved it, I should have to copies of it one in PDF and one in Excel (having unique file #) saved in 2 different location.
    And whenever I want to see my previous saved file in excel for any modification I should have that Excel filled form saved in excel folder.
    but now when I fill the excel form and save, it saved in excel & pdf in 2 different locations and when I open my excel saved file it cleared my data.
    I hope you understand and help me out.

    Thanks for all your time and care

    Ray

  16. #16
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Code: Save file in excel & Pdf at 2 different locations

    Quote Originally Posted by ray.kanata View Post
    What I want: when I open my saved excel file in excel folder, it should have same File # (C1) AND all data filled in it.
    Just remove the code in ThisWorkBook.

    I don't understand about the unique number, do you have to get it somewhere?

  17. #17
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Code: Save file in excel & Pdf at 2 different locations

    Thanks for asking.
    Unique nimber is what's in C1 (increment) means every file saved have different number.
    For Example:
    When I fill the form for one project and save it. And again when i open my original form to fill for next project. It saves file in in 2 formats (Excel & Pdf) in 2 different folders with same number (25001).

    Now I open the original form again and fill for another project and save. It saves file in in 2 formats (Excel & Pdf) in 2 different folders with same number (25002).

    and so on

    BUT THE PROBLEM IS......when I open the saved excel file (25001 OR 25002) I lose my data.

    I want to keep data I filled in those saved files (25001 & 25002) and don't want them to increament.


    STEP 1: Original Form to fill project data (whenever I save this form it should save file in 2 formats (Excel & Pdf) in 2 different folders for record)
    STEP 2: When I open the Original Form it increment C1 (I call it unique file #) and I fill again and save as in STEP 1.
    STEP 3 When I open saved file (25001 or 25002) I want my project data along with same file # (C1) in C1. It should not increment or clear my form once saved in STEP 1.


    Once again thanks Bolkeman!


    Ray
    Attached Files Attached Files
    Last edited by ray.kanata; 02-06-2015 at 11:43 AM.

  18. #18
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Code: Save file in excel & Pdf at 2 different locations

    Try the file, remember to change the username. Next, you need to enable programmatic access to the VBA Project, click the Developer item on the main Ribbon and then click the Macro Security item in the Code panel. In that dialog, choose Macro Settings and check the Trust access to the VBA project object model.
    Attached Files Attached Files
    Last edited by Blokeman; 02-07-2015 at 09:25 AM.

  19. #19
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Code: Save file in excel & Pdf at 2 different locations

    Great, Thanks Bolkeman

    It saves well in both format and keep the data in saved excel file!
    But it doesn't clear the original form for next time to fill.

    Once again thanks

    Ray

  20. #20
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Code: Save file in excel & Pdf at 2 different locations

    Replace the code from your ThisWorkbook to the code in post#14.

  21. #21
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Code: Save file in excel & Pdf at 2 different locations

    Gr8!

    Thanks Bolkeman, you are really good in coding.

  22. #22
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Code: Save file in excel & Pdf at 2 different locations

    Sorry Blokeman,

    I misspelled your name!

    Thnx Once Again

  23. #23
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Code: Save file in excel & Pdf at 2 different locations

    No problem

+ 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. Converting excel 2003 file ext macro file-save code to reflect excel 2007 exts
    By pmanoloff in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-20-2013, 12:17 PM
  2. Excel 2010 file with VBA save and send code works-but file can't be found.
    By carlton.clay in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-13-2013, 09:46 AM
  3. Save File in Two Locations
    By Wskip49 in forum Excel General
    Replies: 1
    Last Post: 01-12-2009, 06:05 PM
  4. request macro to save file to multiple, separate locations
    By Joseph Spain in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-26-2005, 10:46 AM
  5. Is it possible to save an Excel file to 2 locations?
    By Chris_7_1 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 01-06-2005, 09:06 PM

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