+ Reply to Thread
Results 1 to 15 of 15

OLEObject Label FontColor/ForeColor

  1. #1
    Registered User
    Join Date
    01-08-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    9

    OLEObject Label FontColor/ForeColor

    I've been banging my head in my keyboard over this.
    All I want to do is, with VBA code, set the font color (or Forecolor) of an OLEObject called "Label1" in the Activesheet... But I can't get the right syntax. Can any kind soul out where help me out??? I have no problem changing it through the GUI of Excel, but I need to do it frm VBA!

  2. #2
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: OLEObject Label FontColor/ForeColor

    Will this help you?

    One of the three.

    Please Login or Register  to view this content.
    Kind regards, Harry.

  3. #3
    Registered User
    Join Date
    01-08-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: OLEObject Label FontColor/ForeColor

    A step in the right direction, thx Harry. Using this in the code for the Worksheet is working properly, I've had all my tries in a Module.

    But I did get one piece of code to actually change the ForeColor but it still doesn't forefill my needs
    Please Login or Register  to view this content.
    Enough of me trying, I would love to use your code...Sorry for not giving you the whole Picture, but I wasn't sure what I was asking for (still aint)
    But what I want to do is when I trigger a "Worksheet_Change" event or even better within the other code in a Module after been using a ColorDialog and storing the "Long"-result in a cell, I want to set the ForeColor on a bunch of Labels (up to 54 of them in a single sheet). How do I accomplish that? Or is there a way to call a sub that's within the Worksheet from a sub in a Module? 'Cause the last part will also solve my issue (in a not so pretty way thou). I can always hardcode all 54 labelnames

    Best Regards
    Jonny

  4. #4
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: OLEObject Label FontColor/ForeColor

    Make a look-a-like example by what you mean Jonny.

  5. #5
    Registered User
    Join Date
    01-08-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: OLEObject Label FontColor/ForeColor

    Here it goes. Sorry for leading you in the dark earlier...

    First a simple sheet with a command button, a cell that works as a "ResultCell" and then the 3 OLEObjects as Labels
    SetForeColorOfLabels.PNG

    The code that goes with the command button
    Please Login or Register  to view this content.
    ...and the code that lies withing the Module
    Please Login or Register  to view this content.
    Thx again for your help!

  6. #6
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: OLEObject Label FontColor/ForeColor

    It will appreciated if it is an .xls or .xlsm extension Jonny.
    Thanks.

  7. #7
    Registered User
    Join Date
    01-08-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: OLEObject Label FontColor/ForeColor

    It's a .xlsm-file

    Jonny

  8. #8
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: OLEObject Label FontColor/ForeColor

    In your reply it's a .PNG
    I can unfortunately not working/testing with.

  9. #9
    Registered User
    Join Date
    01-08-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: OLEObject Label FontColor/ForeColor

    I'm not able to upload such an "image". That's the reason I just show you all the part of the excel file. How do I upload a xlsm-file?

  10. #10
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: OLEObject Label FontColor/ForeColor

    At the same way you did with the .PNG.
    Otherwise make a Zip or Rar.

    A small example is enough.

  11. #11
    Registered User
    Join Date
    01-08-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: OLEObject Label FontColor/ForeColor

    The only way I can find to attach a file (upload to the forum) is to "Insert Image". The only allow file types are jpg, jpeg, png, gif. Just renaming my example will give the error "This is not a valid image file"... What am I missing?

  12. #12
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: OLEObject Label FontColor/ForeColor

    I do it this way.

    Go advanced,
    Click on the paperclip, add file, select file, upload files, done.

  13. #13
    Registered User
    Join Date
    01-08-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: OLEObject Label FontColor/ForeColor

    PNG files still gets the same error, but the zip file seems to be working

    Thanks for hanging in there!
    Attached Files Attached Files

  14. #14
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: OLEObject Label FontColor/ForeColor

    This will do the trick Jonny.

    Please Login or Register  to view this content.
    Last edited by HSV; 01-14-2013 at 03:57 AM. Reason: More Compact

  15. #15
    Registered User
    Join Date
    01-08-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: OLEObject Label FontColor/ForeColor

    Perfect! Thanks alot for all your help Harry!

    Now I'm a happy man

  16. #16
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: OLEObject Label FontColor/ForeColor

    You're welcome.

    I'm glad you're a happy man.
    I changed the code a little (compact).
    Please don't forget to mark the thread solved.
    Thanks.

+ 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