Closed Thread
Results 1 to 7 of 7

Link a print and Save As Code to one button?

  1. #1
    Registered User
    Join Date
    01-19-2011
    Location
    Kansas, USA
    MS-Off Ver
    Excel 2007
    Posts
    28

    Question Link a print and Save As Code to one button?

    I am trying to make a button with two codes in it I have been reading but I can't seem to find what I am looking for.
    I have a save as code and a print code but I want it to go to one button. Is this possible.
    I am just learning this Macro stuff and want to learn more so please explain how to do this if possible.
    Thank You

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,411

    Re: Link a print and Save As Code to one button?

    It would help if you posted a sample workbook with some typical data and the code you have developed and someone will help you to bring them together.

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Link a print and Save As Code to one button?

    If your two codes are already working, then your button code can simply call those other macros.

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    01-19-2011
    Location
    Kansas, USA
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: Link a print and Save As Code to one button?

    Ok here are the codes that i have used and maybe I need something different. Like I said I am just learning.
    Sub MySave()
    ActiveWorkbook.SaveAs "C:\MyPath\MyFile.xls
    End Sub

    Sub My Print()
    ActiveSheet.Printout
    End Sub
    I have these on seperate modules and they do work individually but I would like them to work together on one button.
    Thanks for the help.

  5. #5
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Link a print and Save As Code to one button?

    hi countryred,

    try this
    Please Login or Register  to view this content.
    john

  6. #6
    Registered User
    Join Date
    07-02-2014
    Location
    El Salvador
    MS-Off Ver
    Ms Office 2010
    Posts
    5

    Re: Link a print and Save As Code to one button?

    Hey john55, I'm trying to use that code to save and print as well, but there's one tiny little detail: I want to create the file for my virtual record, but how could I code it in order to get a different name everytime? Maybe to include a date number after the name (MyFile.xls in your sample), taking it from one of the cells in my workbook, so everytime it will look like: (MyFile02142010.xls) and the day after: (MyFily02152010.xls).

    I would appreciatte your help so very much!

    o

  7. #7
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Link a print and Save As Code to one button?

    Welcome to the forum.

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

Closed Thread

Thread Information

Users Browsing this Thread

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

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