+ Reply to Thread
Results 1 to 5 of 5

Error adding ActiveX Control Combo box with "For Each oPic In Me.Pictures"

  1. #1
    Registered User
    Join Date
    09-26-2011
    Location
    Rhode Island
    MS-Off Ver
    Excel 2007
    Posts
    2

    Smile Error adding ActiveX Control Combo box with "For Each oPic In Me.Pictures"

    Hello

    I am new to the formum and just getting into more VB thru Excel and I am looking for a little help please.

    I read multiple threads/posts on using pictures within excel.

    I have the image lookup working great using this code based on http://www.mcgimpsey.com/excel/lookuppics.html.

    Please Login or Register  to view this content.
    However, now when I go to insert an activex control Combobox I start getting errors.
    Run-time error '13' to be specific.
    Plus my combobox disappers.

    If I go back into design mode and delete combobox the issue goes away.

    I am looking to add multiple activex comboboxes and would appreciate any help.

    Thanks
    Cbell
    Last edited by cbell; 09-28-2011 at 08:53 AM. Reason: Fixed Code Tags

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Error adding ActiveX Control Combo box with "For Each oPic In Me.Pictures"

    Hi cbell, welcome to the forum. Please have a look at the forum rules, then edit your post to include code tags. Once the tags have been added, we'll be happy to help you solve your problem.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    157

    Re: Error adding ActiveX Control Combo box with "For Each oPic In Me.Pictures"

    Pictures are shape objects of type 13.
    The combo box is a shape object of type 12.
    For some reason, the combo box shape is being included in the Picture objects, so it is being hidden by the code.
    One solution is to avoid the Picture objects in "Dim OPic as Picture", and instead use "Dim OPic as Shape".
    This however does mean you can't use the "Me.Pictures.Visible = False" line and instead have to loop through all of the sheet's shapes and hide only those of type 13 (Pictures).
    Also, the part of the code that shows and positions the F1 picture will also need to first test each shape's type and only act on type 13 shapes...
    Please Login or Register  to view this content.
    This code will also circumvent another known Picture object problem, namely that after something like 60 pictures on the sheet the code fails to recognise further pictures, and throws another error.

    Beau Nydal

  4. #4
    Registered User
    Join Date
    09-26-2011
    Location
    Rhode Island
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Error adding ActiveX Control Combo box with "For Each oPic In Me.Pictures"

    Wow, Thank you very much Beau. Worked great.

  5. #5
    Registered User
    Join Date
    09-23-2013
    Location
    Tijuana
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Error adding ActiveX Control Combo box with "For Each oPic In Me.Pictures"

    This is waaaay too gooooood.

    This post is the reason i registered on this forum Thanx soo very much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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