Results 1 to 7 of 7
  1. #1
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    allow user to add image (Excel 2003)

    I'd like to ask for advice / suggestions on ways to let a user paste their logo into my Excel app or browse for their graphic file. The picture below is a sample of the screen the user sees to get their logo. I want to use it for printing an invoice and so will have their logo, ship-to and bill-to address, products purchased, prices, etc. on this sheet which will get created on-the-fly by my code.

    1. If they paste the image on the area I want them to, how do I fetch it to paste on my invoice sheet? I guess I'd need some button for them to tell me that they did pasted it, right? Then hopefully it's not so huge it'll look bad but that's their probme, eh?

    2. So then I need to fetch the image by searching for shapes on that sheet?

    3. Once I know the name I'd then copy/paste it to my other invoice sheet (hidden from the user since I build it programmatically) and somehow position it where it's to sit. I've never had to move or position graphics before so not sure what options I have here.

    Any suggestions?

    Deb

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: allow user to add image (Excel 2003)

    I don't know if pasting is the ideal method - hard to control.
    I would display a File Open dialog using Application.GetOpenFileName or Application.FileDialog (the latter in Excel 2002 or later only), then use the Shapes.AddPicture method of the Invoice sheet; this method has useful arguments such as FileName and Top/Left/Width/Height.

  3. #3
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: allow user to add image (Excel 2003)

    Yeh I tend to agree about pasting. Also, it's much more likely that they have the image file itself and not an editor program where they could actually get it into the clipboard. Ok I'll experiment with the .AddPicture method.

    Thnx, Deb

  4. #4
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: allow user to add image (Excel 2003)

    Does the attached sample give any helpful ideas?

    Alan

  5. #5
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: allow user to add image (Excel 2003)

    *ha* This is great! So where's the magic code? How does this work? All I see is big ugly feet all over the worksheet <img src=/S/clever.gif border=0 alt=clever width=15 height=15>

    Deb

  6. #6
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: allow user to add image (Excel 2003)

    There is no code, if you look carefully you will see that all the Pictures are in place when you open the workbook, but they just show the gridlines from the Cells around A1, until you move a more interesting picture there.

    StuartR

  7. #7
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: allow user to add image (Excel 2003)

    The "trick", if you like, is to copy a range of cells and paste a link to that range in various places in the workbook. I don't know if it's intentional or not, but whatever sits on top of the original range becomes part of the copy/ paste-link target. It seemed like what you might want. Maybe you could shade all the logo placeholder ranges and display text "Don't type in this space", and make sure that the inserted logo is "Brought to Front" to then cover this over. There's a method here describing the process.

    Alan

Posting Permissions

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