+ Reply to Thread
Results 1 to 2 of 2

Having trouble with creating a "Button.

  1. #1
    Registered User
    Join Date
    11-22-2013
    Location
    USA
    MS-Off Ver
    2003, 2007, 2010, Office 365
    Posts
    32

    Having trouble with creating a "Button.

    This is a two part request. Before you spend time analyzing the code, please read #2.

    (1.) I have tried to create a command button to display a picture with the following code:

    Private Sub CommandButton1_Click()
    Application.ScreenUpdating = False

    Dim LineName As String, T As String

    myDir = "C: \users\me\pictures\stuff"
    LineName = Range("A2")
    T = ".jpg"

    ActiveSheet.Shapes.AddPicture Filename:=myDir & LineName & T, linktofile:=msoFalse, savewithdocument:=msoFalse, Left:=190, Top:=10, Width:=434, Height:=205

    Application.ScreenUpdating = True

    End Sub


    When I click it gives me Run-time error '1004': The specified value is out of range, and the ActiveSheet.Shapes.AddPicture Filename:=myDir & LineName & T, linktofile:=msoFalse, savewithdocument:=msoFalse, Left:=190, Top:=10, Width:=434, Height:=205 line is highlighted yellow.


    (2.) When the issue with this code is solved, then how do I get the picture to go away? My preferred method is to forget the above code and create a button to have a picture displayed when the user hovers the pointer over it and then go away after the pointer is moved away. However, I am OK with whatever works.
    Attached Images Attached Images
    Last edited by Zimmerray1; 02-20-2018 at 05:23 PM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,962

    Re: Create a button that displays information.

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)


    Want to get your question answered quickly?
    • Ensure your question is not too vague. Don't assume anyone is familiar with your problem. While you can upload small attachments, describe your problem in the body of the post. We are fortunate to have several Excel gurus, but few mind-readers.
    • On the other hand, skip irrelevant details. Be descriptive and concise. Short, direct, and to-the-point questions with apt thread titles are almost always answered promptly.
    • Keep the scope reasonably narrow. Questions like, "How do I set up an accounting system in Excel?" might be a long time waiting.
    • Explain what you've already tried. ("Calculation is set to automatic, but formulas still don't compute") so helpers don't waste your time or theirs.
    • Post a WORKBOOK. Nobody wants to type data from a picture or paste text from your post into a spreadsheet as a prelude to helping. To attach a file, push the button with the paperclip (or scroll down to the Manage Attachments button), browse to the required file, and then push the Upload button.
    • If your question has not been answered within a day, consider adding another post with any additional information you believe is relevant. If you think your post is good as is, just reply to your own thread with the words "Bump no response", which will bring it to the top of the forum.


    Go to the Commercial Services section of this site http://www.excelforum.com/commercial-services/
    And read the FAQ on how to solicit paid help.
    Ben Van Johnson

+ 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] Need help creating pop up box that displays information from box to table
    By ddouget1 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-10-2013, 06:57 AM
  2. Hi, How can I create a button that if you click on it, it's displays the
    By netanel99 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-13-2013, 12:56 PM
  3. Button that displays date and changes x# of days when clicked
    By Perdurable in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-25-2013, 11:16 AM
  4. Ribbon button displays sourcefile name
    By Edwin1962 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-12-2012, 03:05 PM
  5. [SOLVED] One drop box, one click displays information in excel fields.
    By drarmy in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 09-20-2012, 03:18 AM
  6. How do I make a form that displays rows of information?
    By dustinsroberts in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-14-2011, 04:55 PM
  7. text box for displays of information in excel cells
    By eugene in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 04-03-2006, 11:58 AM
  8. How to Create a Search box and button for text information in an excel sheet.
    By nigey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-05-2005, 06:06 PM

Tags for this Thread

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