Results 1 to 7 of 7

Thread: INSERT icon from c:\mydir... in cell

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,580

    INSERT icon from c:\mydir... in cell

    I have a icon (gif) in c:\mydir\icons\ico1.gif

    i need to insert this icon to the right of this value similar:

    ws.Range("AG" & RIGA1).Value = Format(SDO, "#,##0.00")& " "& c:\mydir\icons\ico1.gif

    how to via vba code?
    Tks.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: INSERT icon from c:\mydir... in cell

    as excel would see the formatted string as numeric, therefore right aligned in the cell, the icon would need to be in the next column?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,580

    Re: INSERT icon from c:\mydir... in cell

    Quote Originally Posted by westconn1 View Post
    as excel would see the formatted string as numeric, therefore right aligned in the cell, the icon would need to be in the next column?
    No.
    i have posted a number range but i rially use a string not number....
    But is really possible to insert to right of string in the same cell a icon from path?
    Tks.

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: INSERT icon from c:\mydir... in cell

    Can you perform the operation manually?
    If so, turn on Marco Recording, perform the action, then stop recording. You should then be able to go look at the macro, see the VBA code it generated... based on that you should then be able to adapt it to your needs.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,580

    Re: INSERT icon from c:\mydir... in cell

    Quote Originally Posted by techgnome View Post
    Can you perform the operation manually?
    If so, turn on Marco Recording, perform the action, then stop recording. You should then be able to go look at the macro, see the VBA code it generated... based on that you should then be able to adapt it to your needs.

    -tg
    hummmmmmm....
    i need to loop 8.458 lines, and insert in the existing value of cells the icon on the right.!

  6. #6
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: INSERT icon from c:\mydir... in cell

    That's not quite what I had in mind... I figured you would do it ONCE... see how Excel does it in a macro... then ADAPT that code to your needs... such as putting it in a loop, etc...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: INSERT icon from c:\mydir... in cell

    But is really possible to insert to right of string in the same cell a icon from path?
    i do not believe so, but it should be possible to position an image over a cell so that it appears as if it is
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width