Solved

Excel Macro

Posted on 2014-10-23
6
163 Views
Last Modified: 2014-11-18
I have a column that contain the link of a photo (eg. n:\myPhoto\xxxx.jpg). Any idea how to write a macro such that it can replace the text file with a actual photo and resize it to a particular width and length, Tks
0
Comment
Question by:AXISHK
6 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40401207
You use code such as:

    
    ActiveSheet.Pictures.Insert(cells(1,1)).Select
    Selection.ShapeRange.ScaleWidth 0.3, msoFalse, msoScaleFromTopLeft
    Selection.ShapeRange.ScaleHeight 0.3, msoFalse, msoScaleFromTopLeft

Open in new window

0
 
LVL 26

Expert Comment

by:ProfessorJimJam
ID: 40401212
how big the photos pixels are? the width and height?
0
 

Author Comment

by:AXISHK
ID: 40405604
787 x 787 , size 248KB.

Tks
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40449707
I've requested that this question be deleted for the following reason:

The question has either no comments or not enough useful information to be called an "answer".
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40449708
I thought my answer actually answered the question.

The question and my answer are:

Question: Any idea how to write a macro such that it can replace the text file with a actual photo
Answer:      ActiveSheet.Pictures.Insert(cells(1,1)).Select

Question:  and resize it to a particular width
Answer:     Selection.ShapeRange.ScaleWidth 0.3, msoFalse, msoScaleFromTopLeft

Question: and length,
Answer:     Selection.ShapeRange.ScaleHeight 0.3, msoFalse, msoScaleFromTopLeft
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question