+ Reply to Thread
Results 1 to 13 of 13

Help with Print and SaveAs Macro

  1. #1
    Forum Contributor
    Join Date
    05-22-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007
    Posts
    144

    Help with Print and SaveAs Macro

    Dear All,

    Please, I need help with a SaveAs macro that will Print and SaveAs.

    1. I have designed a form on a worksheet which needs to be populated with data from other worksheets in the workbook.

    2. When that is complete, the form needs to be printed out and saved in a folder named ‘COMPLETE’ on the desktop.
    3. The worksheet that houses the form has a number of command buttons used for some other purposes, but the PRINT AREA of the form has been defined as B9:M64

    4. What I need is for the form to be printed out (when complete) based on the defined PRINT AREA and then SavedAs in the COMPLETE folder (using the name on Cell D7.

    5. The saved copy should be the form that is printed out (as an ordinary form and not as a macro-enabled form/file)

    6. I found a PRINT macro and SAVEAS macro differently. I combined both of them and tried to tweak it to give me the result that I desire. I ended up with the following:

    Please Login or Register  to view this content.
    7. The Print part on its own works OK. However, the SaveAs part does not work correctly. Tested on its own, the SaveAs part saves the entire worksheet (including all the command buttons on the sheet and the formulas in each of the cells, the worksheet tab name, etc.) That is not what I want.

    8. I want what is printed to be just what is also SavedAs, please.

    I should be grateful for help with the above (especially the SaveAs part) to enable me to achieve the outcome that I desire.

    Thanks all for your help.

    Newqueen

  2. #2
    Forum Contributor
    Join Date
    05-22-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007
    Posts
    144

    Re: Help with Print and SaveAs Macro

    Can someone, please, kindly help with this thread.

    Thanks

    Newqueen

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,558

    Re: Help with Print and SaveAs Macro

    What do you mean by "an ordinary form"? excel.xlsx? PDF?

  4. #4
    Forum Contributor
    Join Date
    05-22-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007
    Posts
    144

    Re: Help with Print and SaveAs Macro

    Hi Jolivanes,

    Thanks for your kind response. I am sorry if my thread was not clear on that.

    I mean Excel.xlsx, NOT PDF.

    When the Form is printed out, it just prints out as a Form designed. The printed output does not come with the command buttons on the sheet etc. It is just the defined Print Area (i.e. the Form itself) that is printed. This is also what I want saved, if it is possible. I suppose that would be Excel.xlsx.

    Thanks for your help.

    Newqueen

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,558

    Re: Help with Print and SaveAs Macro

    For saving, this should work.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    05-22-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007
    Posts
    144

    Re: Help with Print and SaveAs Macro

    Thank you Jolivanes for the Save macro that you provided above. Using my baby knowledge in vba, I added it to the 'Print' macro and came up with the following:

    Please Login or Register  to view this content.
    1. Unfortunately, the 'Saving' part of the macro does not give me the desired outcome.

    2. The 'Print' part of the macro still seems OK when I do a Print Preview. It prints only the defined Print Area of the Worksheet i.e. B9:M64 of the Worksheet.

    3. But the added 'Saving' part saves the entire worksheet, including the command buttons and tab name of the worksheet.

    4. I am thinking that if the PrintArea B9:M64 is also to the 'Saving' part of the macro, it will produce the desired outcome, i.e. the macro will save only the area of the worksheet that is printed which is the same area that should be saved.

    5. I do not know how to add the defined Print Area to the 'Saving' part.

    6. If it is possible to add that, please could you kindly help with that. I am confident that it should solve the problem.

    In any case, I rely on your superior opinion in these matters.

    Thanks for all your help.

    Newqueen

  7. #7
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,558

    Re: Help with Print and SaveAs Macro

    Try on a copy of your original (different name).
    If the outcome is what you have in mind, code can be cleaned up I think.

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    05-22-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007
    Posts
    144

    Re: Help with Print and SaveAs Macro

    Hi Jolivanes,

    Thanks for all your time and help. I am grateful.

    I have tried the macro that you provided in Post #7 above. Unfortunately, the outcome is still not quite what I need:

    1. The macro deletes the command buttons on top - including, unfortunately, the company logo.

    2. It still does not save the defined Print Area which is the area that is Printed out when a print-out is desired.

    3. To clarify exactly what I need, I have attached a SAMPLE2 Excel file which contains a mock template of a designed form.

    4. As you will see from the form, it has a defined Print Area which is C5:O35.

    5. If you do a print-out of the form, it will get a print-out only of the area C5:O35.

    6. That same area that is printed is the exact area that I would like saved, if it is possible.

    I hope that with the attached Sample2 file, I have been able to make clearer what I am requesting for.

    Thanks for everything.

    Newqueen
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,558

    Re: Help with Print and SaveAs Macro

    I hope you're not too surprised that it does not do what you want.
    In my code the print area is set to B9:M64 as you have in Post #6.
    Now you say it should be C5:O35.
    I can't find it anywhere where you ask for deleting everyting except a logo.
    Need to know the name of the logo so it can be exempt. (Picure 1 or Our Company Logo or whatever)
    The file should be named as the text in D7. Nothing in D7.
    Do not use merged cells. Use Center Across Selection instead.

    If you only supply half the information or wrong information you'll never get a proper answer.

  10. #10
    Forum Contributor
    Join Date
    05-22-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007
    Posts
    144

    Re: Help with Print and SaveAs Macro

    The Sample2 file was just designed a few minutes before posting - just to give a better idea of what I am looking for. The Print Area of C5:O35 relates to the sample2 file posted. The B9:M64 relates to the 'live' file.

    The Sample2 file has been designed very much like the live file. My reason for designing and attaching the Sample2 file is that if you look at it, and craft your vba code to work with it, and it works, then I can apply the 'worked code' of the Sample2 file to the live file.

    BTW, the D7 in the live file is = F7 in the Sample 2 file.

    I am sorry for the misunderstanding.

    Newqueen
    Last edited by newqueen; 06-01-2018 at 11:58 PM.

  11. #11
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,558

    Re: Help with Print and SaveAs Macro

    See attached
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    05-22-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007
    Posts
    144

    Re: Help with Print and SaveAs Macro

    Hi Jolivanes,

    Thanks heaps for your kindness and patience. That is exactly what I need. Your kindness and expertise are very much appreciated.

    Again, thanks very much.

    Newqueen

  13. #13
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,558

    Re: Help with Print and SaveAs Macro

    Thank you for letting us know that all is as you requested.
    Good luck and enjoy the weekend

+ 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. pb with [VBA] saveas instruction in Macro
    By Mahler in forum PowerPoint Formatting & General
    Replies: 6
    Last Post: 11-27-2015, 11:37 AM
  2. Disabled print toolbar and menu but Print Macro button cannot print also...
    By zein97 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-22-2014, 01:42 PM
  3. SaveAs Macro
    By bhenderson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-29-2011, 12:04 AM
  4. SaveAs Macro
    By sumitomo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-12-2010, 04:54 PM
  5. SaveAs macro
    By mrggutz in forum Excel General
    Replies: 5
    Last Post: 08-09-2010, 11:54 AM
  6. [SOLVED] SaveAS macro Query
    By Nigel in forum Excel General
    Replies: 1
    Last Post: 05-13-2005, 01:06 PM
  7. [SOLVED] Saveas Macro
    By Nigel in forum Excel General
    Replies: 3
    Last Post: 05-11-2005, 09:06 AM

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