+ Reply to Thread
Results 1 to 6 of 6

Centering image (horizontally) in Range

  1. #1
    Registered User
    Join Date
    06-06-2009
    Location
    Helmond
    MS-Off Ver
    Excel 2007
    Posts
    18

    Centering image (horizontally) in Range

    Hello,

    Excuse me if I'm asking a simple question, but I'm a bit of a noob when it comes to VBA. As a matter of fact I live on Copy and Paste and sometimes I actually understand what I've copied and I'm able to adjust it to my needs. In this manner I have made an excel file that imports pictures from my harddisk into a named Range. I have tried many other sites for an answer. I have however not been able to center the images horizontally (width of different images varies) in that Range.

    I would be very gratefull if someone could help me with this.

    Below is the code I have copied and adjusted:
    Please Login or Register  to view this content.
    Thanks in advance...

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Centering image (horizontally) in Range

    Why do you have three InsertPicFromFile subs?

    Do you want the picture fitted to the height of the destination range and centered horizontally?

    Whay are you doing this?

    Please Login or Register  to view this content.
    Last edited by shg; 02-03-2011 at 01:38 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    06-06-2009
    Location
    Helmond
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Centering image (horizontally) in Range

    Quote Originally Posted by shg View Post
    Why do you have three InsertPicFromFile subs?
    Because I have three different pictures in three different places in the document. In the end it will be over 20 because it's going to be a fitness training program.

    Quote Originally Posted by shg View Post
    Do you want the picture fitted to the height of the destination range and centered horizontally?
    Yes!

    Quote Originally Posted by shg View Post
    Whay are you doing this?

    Please Login or Register  to view this content.
    This part I copied from another excel document, but I don't know how to adjust it to center the picture...

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Centering image (horizontally) in Range

    Try this:
    Please Login or Register  to view this content.
    Last edited by shg; 02-04-2011 at 10:51 AM.

  5. #5
    Registered User
    Join Date
    06-06-2009
    Location
    Helmond
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Centering image (horizontally) in Range

    Thanks shg for your effort, but including this code introduces a whole bunch of error codes that I'm not able to eliminate....

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Centering image (horizontally) in Range

    If you're looking for help, that's not much information.

+ 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