+ Reply to Thread
Results 1 to 15 of 15

How to use CommandButton instead of TextBox on Chart?

  1. #1
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Europe
    MS-Off Ver
    Office 2021 - Win10
    Posts
    1,007

    How to use CommandButton instead of TextBox on Chart?

    Hi beautiful people,
    1- Open enclosed file.
    2- Run Macro1.
    Please Login or Register  to view this content.
    3- Click "Sent Chart To Desktop" in order to sent Chart to the desktop as picture.
    4- See that you have a chart picture in your desktop.
    Everything is okey until now...

    Question: How to use CommandButton instead of TextBox above code?
    Note: Command Button must be able to move with chart!

    Thanks in advance...
    Attached Files Attached Files
    Last edited by HerryMarkowitz; 08-23-2015 at 03:53 AM.
    Sub DontForgetThese()
         If Your thread includes any code Then Please use code tags...
         If Your thread has been solved Then Please mark as solved...
         If Anybody has helped to you Then Please add reputation...
    End Sub

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441

    Re: How to use CommandButton instead of TextBox on Chart?

    You can not embed forms controls in to a chart object.
    So you can add the button to the worksheet but it will not move with the chart unless you group them.

    You could add a shape that looks like a button and has macro assigned.
    Please Login or Register  to view this content.
    You can incorporate that into your existing code
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Europe
    MS-Off Ver
    Office 2021 - Win10
    Posts
    1,007

    Re: How to use CommandButton instead of TextBox on Chart?

    Hi Andy,
    Thanks for the code.
    I need CommandButton instead of TextBox because CommandButton has PrintObject:False property.
    Because I dont want to see TextBox on the Chart when printing.
    So, There is no difference between using TextBox or soShapeBevel...
    Do you have any other idea?
    BR

  4. #4
    Registered User
    Join Date
    12-11-2012
    Location
    London
    MS-Off Ver
    2010
    Posts
    9

    Re: How to use CommandButton instead of TextBox on Chart?

    Hi,

    But shapes can be set not to print too.

    Edit: Same with text box

    Edit2:

    Please Login or Register  to view this content.
    Last edited by Nivvi; 08-23-2015 at 08:21 AM.
    In /dev/null No One Can Hear You Scream

  5. #5
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Europe
    MS-Off Ver
    Office 2021 - Win10
    Posts
    1,007

    Re: How to use CommandButton instead of TextBox on Chart?

    Hi Nivvi,
    Thanks for the code.
    Following code works if there is only TextBox on the Sheet.
    Please Login or Register  to view this content.
    Following code doesnt work if TextBox located on the Chart.
    Please Login or Register  to view this content.
    So, this issue havent been solved yet...
    Last edited by HerryMarkowitz; 08-23-2015 at 11:24 AM.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441

    Re: How to use CommandButton instead of TextBox on Chart?

    Does the macro assigned to the shape print the chart? If so make the shape invisible whilst printing

  7. #7
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Europe
    MS-Off Ver
    Office 2021 - Win10
    Posts
    1,007

    Re: How to use CommandButton instead of TextBox on Chart?

    Quote Originally Posted by Andy Pope View Post
    Does the macro assigned to the shape print the chart? If so make the shape invisible whilst printing
    But user must see following text on the chart;
    "Print Chart as Picture to the Desktop"
    So, making shape invisible is not good idea.

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441

    Re: How to use CommandButton instead of TextBox on Chart?

    I mean make it invisible whilst exporting or printing. Once that is done you make the button visible again

  9. #9
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Europe
    MS-Off Ver
    Office 2021 - Win10
    Posts
    1,007

    Re: How to use CommandButton instead of TextBox on Chart?

    Quote Originally Posted by Andy Pope View Post
    I mean make it invisible whilst exporting or printing. Once that is done you make the button visible again
    Sorry, I cant understand what you mean.
    Can you post a vba code for this?

  10. #10
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441

    Re: How to use CommandButton instead of TextBox on Chart?

    Not without seeing your macro2.
    I assume that this original code line assigned the print macro to the text box.

    Please Login or Register  to view this content.
    So Macro2 would go something like

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Europe
    MS-Off Ver
    Office 2021 - Win10
    Posts
    1,007

    Re: How to use CommandButton instead of TextBox on Chart?

    Hi Andy,
    Following code doesnt work if TextBox located on the Chart.
    Please Login or Register  to view this content.
    Any idea?

  12. #12
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441

    Re: How to use CommandButton instead of TextBox on Chart?

    I suggested an alternative, did that not work?

  13. #13
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Europe
    MS-Off Ver
    Office 2021 - Win10
    Posts
    1,007

    Re: How to use CommandButton instead of TextBox on Chart?

    It is working...
    But if there are more than one shape on the chart then all shapes will be invisible...
    So, I need a code which must include TextBox(1)...

  14. #14
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441

    Re: How to use CommandButton instead of TextBox on Chart?

    So change the code to only make those shapes you don't want invisible.

    If shape(1) is not your textbox then change the code

    Please Login or Register  to view this content.

  15. #15
    Forum Contributor HerryMarkowitz's Avatar
    Join Date
    09-10-2012
    Location
    Europe
    MS-Off Ver
    Office 2021 - Win10
    Posts
    1,007

    Re: How to use CommandButton instead of TextBox on Chart?

    Thanks a lot! Solved

+ 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. [SOLVED] value for textbox goes to commandbutton
    By aimjhun in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-09-2013, 09:54 PM
  2. Add Sheet with a CommandButton & TextBox
    By zplugger in forum Excel General
    Replies: 0
    Last Post: 01-18-2013, 09:52 AM
  3. Listbox to textbox via commandbutton
    By himanshu83 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-14-2010, 03:14 PM
  4. Link commandbutton to textbox
    By ncaravela in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-22-2010, 12:51 PM
  5. VBA TextBox determines CommandButton??
    By newty in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-17-2010, 03:41 PM
  6. Userform question re: textbox/commandbutton
    By djvice in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-05-2007, 10:40 AM
  7. Hiding A TextBox On A UserForm Under A CommandButton
    By Minitman in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-26-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