+ Reply to Thread
Results 1 to 13 of 13

Excel Picture Database

  1. #1
    Registered User
    Join Date
    07-25-2007
    Posts
    8

    Question Excel Picture Database

    I need some help, can't find anything and tried everything. I’m no expert in excel or macro. Let me start.

    I have excel worksheet with 2 sheets in it. Let’s call the one "Database", it consist of 713 rows and 15 columns with data in of my product. Then the other one "Display Product" in it you type in the code of the specific product so it search for my code and display all of the information of that product code on the "Display Product" sheet and it that work.

    Now I want to link a picture to that specific product to the code. Here's the code I used:

    Private Sub Worksheet_Calculate()
    Dim oPic As Picture
    Me.Pictures.Visible = False
    With Range("A71")
    For Each oPic In Me.Pictures
    If oPic.Name = .Text Then
    oPic.Visible = True
    oPic.Top = .Top
    oPic.Left = .Left
    Exit For
    End If
    Next oPic
    End With

    End Sub


    Now this code works fine up to a specific limit in my case 66 picture to a product, and I need at least 200 more images in it but I get a runtime error in my macro when I put one more image in. This is where I get the run time error -> “Me.Pictures.Visible = False“.
    I don't know if excel is limited to image usage. Or maybe there is another way to do what I want to do with more advance coding. Can anyone help?

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Sonskyn,

    Your post is quite muddled. I suspect your problems stem from 2 factors. Firstly, your macro is in the Worksheet_Calculate() event, not certain as to why you placed it here. Every time a cell with a Formula changes, or is called by another formula the macro is run. This will slow your program to a crawl.

    Secondly, Storing the pictures on a worksheet takes up a large amount memory. Unless you have issues with program distribution, it is a better to save them in a separate folder, and display the picture when needed. I don't advise using Hyperlinks as there many problematic issues that can arise when using them with VBA coding.

    Sincerely,
    Leith Ross

  3. #3
    Forum Contributor
    Join Date
    09-04-2006
    Location
    Yorkshire, England
    Posts
    267
    Hi,

    Are you following this info?

    HTML Code: 
    If so are you using the lookup?
    As there should be no limit
    JR
    Versions
    Mac OS X 'Leopard'
    Mac MS Office Excel 2004
    Windows XP
    MS Excel 2002
    MS Excel 2003

  4. #4
    Forum Contributor
    Join Date
    09-04-2006
    Location
    Yorkshire, England
    Posts
    267
    Also

    have you got this at the top of your module?

    Please Login or Register  to view this content.
    Could you post your workbook? If so could you remove all confidential data.
    Last edited by JR@SGC; 08-29-2007 at 03:24 AM.

  5. #5
    Registered User
    Join Date
    07-25-2007
    Posts
    8
    Quote Originally Posted by JR@SGC
    Hi,

    Are you following this info?

    HTML Code: 
    If so are you using the lookup?
    As there should be no limit

    Thanks for the reply. Yes I followed that info. And bad thing is I reach a limit looks like it.

    This is the error I get: Run-time error '1004': Unable to set the Visible property of the Picture class..

  6. #6
    Forum Contributor
    Join Date
    09-04-2006
    Location
    Yorkshire, England
    Posts
    267
    Could be something to do with the second sheet of names, have you got them all spelled right? etc

    Can you post your workbook?
    Last edited by JR@SGC; 08-29-2007 at 03:36 AM.

  7. #7
    Registered User
    Join Date
    07-25-2007
    Posts
    8
    Quote Originally Posted by Leith Ross
    Hello Sonskyn,

    Your post is quite muddled. I suspect your problems stem from 2 factors. Firstly, your macro is in the Worksheet_Calculate() event, not certain as to why you placed it here. Every time a cell with a Formula changes, or is called by another formula the macro is run. This will slow your program to a crawl.

    Secondly, Storing the pictures on a worksheet takes up a large amount memory. Unless you have issues with program distribution, it is a better to save them in a separate folder, and display the picture when needed. I don't advise using Hyperlinks as there many problematic issues that can arise when using them with VBA coding.

    Sincerely,
    Leith Ross
    Hi Ross. Sorry that the post is muddled you can get info on the similiar worksheet im working on at:
    http://www.mcgimpsey.com/excel/lookuppics.html their you can download an example worksheet at the bottom of the tutorial. Thanks to JR for this link. My worksheet is just using alot more data than that one.

  8. #8
    Registered User
    Join Date
    07-25-2007
    Posts
    8
    Quote Originally Posted by JR@SGC
    Also

    have you got this at the top of your module?

    Please Login or Register  to view this content.
    Could you post your workbook? If so could you remove all confidential data.
    What is this Option Explicit. Sorry I have the ask boss just expect me to to this in excel and I know nothing about excel. Won't be able to post the worksheet.

  9. #9
    Forum Contributor
    Join Date
    09-04-2006
    Location
    Yorkshire, England
    Posts
    267
    Its probably not a big deal but

    The excel help file says:

    Used at module level to force explicit declaration of all variables in that module

    When Option Explicit appears in a module, you must explicitly declare all variables using the Dim, Private, Public, ReDim, or Static statements. If you attempt to use an undeclared variable name, an error occurs at compile time.

    If you don't use the Option Explicit statement, all undeclared variables are of Variant type unless the default type is otherwise specified with a Deftype statement.

    Note Use Option Explicit to avoid incorrectly typing the name of an existing variable or to avoid confusion in code where the scope of the variable is not clear.

    Basically it helps avoid errors with undeclared vairables.

  10. #10
    Forum Contributor
    Join Date
    09-04-2006
    Location
    Yorkshire, England
    Posts
    267
    Just recrerating your problem be back in a bit

  11. #11
    Registered User
    Join Date
    07-25-2007
    Posts
    8
    Hi JR here the link where u can get my worksheet www.brandunlimited.co.za/picture database.xls . If you look in the Database sheet you will see that I highlighted the row where it stop working.

  12. #12
    Forum Contributor
    Join Date
    09-04-2006
    Location
    Yorkshire, England
    Posts
    267
    There is apparently a limit to how many pictures you can do visible= false to.
    The only work around i can think off is to have all your pictures the same size and stacked on top of each other so you can only see the top one.

    this code (modified from above) will aways show the selected on at the top.

    Please Login or Register  to view this content.
    hope it helps

  13. #13
    Registered User
    Join Date
    07-25-2007
    Posts
    8
    Quote Originally Posted by JR@SGC
    There is apparently a limit to how many pictures you can do visible= false to.
    The only work around i can think off is to have all your pictures the same size and stacked on top of each other so you can only see the top one.

    this code (modified from above) will aways show the selected on at the top.

    Please Login or Register  to view this content.
    hope it helps
    Thanks for all the help JR. I will see what I can do. So far it looks like its doing sumthing.

+ Reply to 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