+ Reply to Thread
Results 1 to 6 of 6

Command button to create a pdf

  1. #1
    Registered User
    Join Date
    03-09-2013
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    11

    Command button to create a pdf

    I am looking to make a command button that will create a PDF of sheet 1 with a file name of what’s typed in cell (I9) and stored in the same folder that the excel sheet is stored.

    I tried a code that Paul made for another user but not sure its what I really need.

    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Command button to create a pdf

    That code will generate a PDF of the currently selected sheets in the workbook, with the same name as the current workbook. To use the value in I9 and print only Sheet1:

    Please Login or Register  to view this content.
    Not necessary to turn off screen updating, this code won't cause any screen updates.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    03-09-2013
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Command button to create a pdf

    ok I am having an issue with getting it right.
    this is what I have for command button 2
    Please Login or Register  to view this content.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Command button to create a pdf

    What is the issue? You need to be specific. If you are getting an error message, provide the text of the message. If you are getting unexpected behavior, describe the behavior. Also describe where is your button and where you put this code.

    I tested this code in Module1 of a sample workbook and it worked, so there is some issue with your setup.

  5. #5
    Registered User
    Join Date
    03-09-2013
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Command button to create a pdf

    Sorry about that
    the private sub commandbutton2_click() is highlighted yellow
    here is the error.
    Please Login or Register  to view this content.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Command button to create a pdf

    You have two Sub declarations, delete the one you don't need:
    Please Login or Register  to view this content.
    [/QUOTE]

+ 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. Create a command button with code with a command button
    By jakara in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2013, 01:28 PM
  2. create a command button
    By mandyg23 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-27-2012, 05:14 PM
  3. Create a Command Button
    By njg2982 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-27-2008, 08:04 PM
  4. [SOLVED] How to Create a Command Button
    By Jason in forum Excel General
    Replies: 1
    Last Post: 10-12-2005, 05:05 PM
  5. [SOLVED] command button:. how can i create a command button
    By ashley in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 08-29-2005, 05:05 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