Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Excel


Insert Picture From Folder

I am using the code below to insert and resize images in excel. I was wondering is it possible to set up this macro so that I can just provide the directory and then have it so that just a random image is inserted rather than specifying an jpg number. The reason i need this is because the numbers in the folder range from 00000 to upto 20000 however not every folder has the full range of images i.e. Z:SingaporeSingapore TurfSingapore Turf Club 2QEII Cup 2006QEII Cup 2006_VDMillenium Copthorne InternationalTVGI Race Name Text may just contain one image and that would be image number 03965.

The other thing I would like to do is to have the name of the las 2 subfolders inserted into the cell above the image so for the example below you would have:

Millenium Copthorne InternationalTVGI Race Name Text

Millenium Copthorne InternationalTVGI Race Name Logo

Sub TestInsertPictureInRange()
InsertPictureInRange "Z:SingaporeSingapore TurfSingapore Turf Club 2QEII Cup 2006QEII Cup 2006_VDMillenium Copthorne InternationalTVGI Race Name Text3965.jpg", _ .........................

View Complete Thread with Replies

Sponsored Links:

Related Forum Messages:
Insert/format Picture From Folder
I am using the code below to insert and resize images in excel. I was wondering is it possible to set up this macro so that I can just provide the directory and then have it so that just a random image is inserted rather than specifying an jpg number. The reason i need this is because the numbers in the folder range from 00000 to upto 20000 however not every folder has the full range of images i.e. Z:SingaporeSingapore TurfSingapore Turf Club 2QEII Cup 2006QEII Cup 2006_VDMillenium Copthorne InternationalTVGI Race Name Text may just contain one image and that would be image number 03965.

The other thing I would like to do is to have the name of the las 2 subfolders inserted into the cell above the image so for the example below you would have:

Millenium Copthorne InternationalTVGI Race Name Text

Millenium Copthorne InternationalTVGI Race Name Logo

View Replies!   View Related
Insert Picture From File Increases File Size More Than The Picture You Inserting
I am putting together a price list in excel and using images and hyperlinks to jazz it up a bit - what I am finding is that if I insert a 25KB GIF image, the excel file grows in size by over 100KB

why is this disproportionate growth happening and is there a way around it - I dont want my Price List growing too large but need the images....?

View Replies!   View Related
Insert Picture
I'm trying to insert a bmp file- small picture into an excel file (sheet 4) in vba.

how do I select the picture and copy it into the excel file.

View Replies!   View Related
Insert Picture Sub Fails In '07
The code below will enable you to browse for a picture and insert it at cell location O9. It works great in excel '03 but when sub is ran in '07 it places the picture at about cell D5 and not really even lined up perfectly with that cell. Does any one have any idea why this is happening and how to make the sub work correctly in '07?

View Replies!   View Related
Insert A Picture-2007
I record a macro in Excel 2007 to insert a picture from a file in the active sheet, but when I stop recording it and I went so see the code and there was no code!!!

I did the same in Excel 2003 and the code was like this:

View Replies!   View Related
Insert Picture In Merged Cells
I have multiple merged cells (all same size). But not all in the same place.

I'm looking for a macro that can insert a picture in a selected merged cells and also size it to the merged cells.

I want to be able to choose a different picture from a location, for examle to network map P:.

I looked around but couldn't fins a code for this.

View Replies!   View Related
Auto Insert And Resize Picture
I have a sheet where I would like to have a picture inserted in a particular cell range and auto resized into that range. What I'm looking for is, if I type the name of a picture (meathead4uu.jpg) in a cell (Say, B3) then the picture should appear in range D14 to E28.

View Replies!   View Related
Insert A Picture In The Word File?
I had copied a macro from this forum [it was posted by either shg or NBVC], and I modified it to fit my needs. The macro creates a new word document and sends a series of cells from an excel worksheet column to this word file. Everything works fine, but now I need to insert a picture after row 14. I have inserted the code [colored red], but I am sure the syntax or something isn't right. That part doesn't work.

View Replies!   View Related
Browse To Insert Picture & Size It
I Have Inspection Reports To Do
And They Come In With One Big Text Srting
I Haveused Formuee To Seperate Them And A Macro To Put Them On Seperate Sheets.but...

I Want To Insert A Picture (for More Indepth Reports)
Rather Than Inserting A Picture Can I Do A Macro That When It Is Run It Opens Up A Browser, Similar To The One In Insert Picture And Then Insert A Picture After The Bottom Cell And Resize It So It Will Be The Same Every Time? But At The Bottom Of The Last Line Of Data.

View Replies!   View Related
Insert Picture Code Not Working In 2007
I have used the following code behind a projects Command button for some time, and works well in Excel 2002/2003.
It's used to look for and insert a Picture file, located on the users PC, select cell C2, re-size it to fit inside a bordered cell area and then nudge it over, off the border line.

Sub Load_Image()
Dim oPict, PictObj
Dim sImgFileFormat As String
'Open file
oPict = Application.GetOpenFilename("All Pictures (*.tif; *.bmp; *.jpg; *.gif; *.jpeg; *.png; *.cpt; *.tiff),*.tif; *.bmp; *.jpg; *.gif; *.jpeg; *.png; *.cpt; *.tiff")
If oPict = False Then End
Set PictObj = ActiveSheet.Pictures.Insert(oPict)
With PictObj
.ShapeRange.LockAspectRatio = msoFalse
.ShapeRange.Width = 712#
.ShapeRange.Height = 510#
End With
With PictObj
Selection.ShapeRange.IncrementLeft 1#
Selection.ShapeRange.IncrementTop 1#
End With

End Sub

Unfortunately, Excel 2007 doesn't seem to identify the Cell reference "C2".
It modifies the Picture size OK but does not position the picture in the correct position.
I've tried re-recording it but 2007 misses most of actions.???
Despite my efforts looking on other forums, I don't seem to find a code that works on both version of Excel.

View Replies!   View Related
Insert Picture (cannot View The Object Properties.)
The error I am getting (highlighted in red) is that it cannot view the object properties. So the picture is put in, but it's emplacement cannot be set and the picture cannot be renamed (which must occur for other macros to see it).
Pages are not protected. The only self automated macro is on workbook open, and it only resizes to view the area depending on the persons resolution.
Microsoft Excel 2003

View Replies!   View Related
Coding File Path To Insert Picture
Explored a few posts on my topic, but didn't quite find what I needed.

I need to open the Insert Picture dialog with it pointed at C:My DocumentsTemp. (Users will be required to save their images files to this location only).

Attempted to run a macro to get the code, but the dialog box forces you to select a file. I only need to get some low skilled users to the folder and let them select the image to insert.

View Replies!   View Related
Protected Sheet - Insert Picture File
Workbook Password Protect 2 Levels. I have managed to write simple but effective code that allows only one password to be enetered to open a SS & offers 3 levels of protection, limited permission to enter data, read-only & data completely hidden. This is excellent for my needs however I want the user who has limited rw to be able to insert a pic file which is their signature but because the sheet has protected cells it won't allow user to insert picture jpg file.

I have just thought of a creative solution tho. What if the picture file is already saved in the workbook and by using code to ask to insert pic file it copies from one location in SS to the appropriate cell in the worksheets?

The scenario is that I have fortnightly timesheets in 12 calendar months in 12 separate sheets. When staff member fills in timesheet I want them to insert signature for that f/night indicating thatthey have filled it in & it is correct but because of protection it won't allow me to.

View Replies!   View Related
Insert Picture Macro Doesn't Work In 2007
I just upgraded to Excel 2007 and my macro from Excel 2003 for inserting a picture doesn't work correctly in 2007. I have a command button that states insert picture and when you click it, it will let you insert a picture into the cell and hide the command button. In 2007 it will let you insert the picture, but it isn't centered and expands into other cells and the command button is still visible. The picture appears to be the correct size it just doesn't center itself in the cell and the command button is still visible. Below is the

View Replies!   View Related
Insert Picture & Auto Size To Active Cell Dimmensions
What I am trying to do is to give the user the ability to insert a photo and have it autosize into a range of cells--so far I can only get it to work with a single cell and a predefined file. Can this be refined so that rng references a group of cells and pic somehow lets the user input a file name or pick its name and location?

Sub test()
On Error Resume Next
Set pic = ActiveSheet.Pictures.Insert("C:
On Error Goto 0
If Not pic Is Nothing Then 'Found it!'
Set rng = ActiveCell
With pic
.Height = rng.Height
.Width = rng.Width
.Left = rng.Left
.Top = rng.Top
End With
End If
End Sub

View Replies!   View Related
Insert Video Clips From Folder
I have been looking at the ShowFilePicsDemo.xls from written by Ron Coderre. This spreadsheet and macros allows a user to choose from a list a picture by name, and the macro references it with the location of the file, the opens the file and the picture appears in a specified range of cells on the spreadsheet.

I was hoping to use it but with very short clips (2-3 secs) as I need to go through about 350 clips one by one to look at oddities on them. I have manually started a macro to insert the video clip in the sheet using the tip given on a thread in this forum called "Playing a video during the presentation" where all the steps are explained. When I reread the macro however, the clip is embedded as an object and loses its identity which means that the macro has no reference to the location of the file which could be used for the next clip.

View Replies!   View Related
Put Chosen Picture In Comment & Retrieve Picture On Other Sheet
I want to have a sample file in excel which store picture of student in comment, I did this, but when I want to insert picture the file dialog appears, and if I click cancel, then there is an error, why? If some one optimise the code it would be very nice

View Replies!   View Related
Insert A Picture That Is On Worksheet Into Another Worksheet
I have written a vba program that creates a report in excel. Most of the pages of the report are created at runtime. I have an image on a hidden worksheet that I need to place into one of the worksheets that is created at runtime. The image is an excel chart that I copied and pasted as a picture. I did this so that I could resize it easily and all of the elements of the chart would maintain their relative sizes. I have tried:

View Replies!   View Related
Write The Picture Name In Cell The Picture Will Appear
i have saved some pictures in my excel sheet.
in the next sheet i want that when i write the picture name the picture will appear as vlookup helps in the getting text and nos. can i do this with pictures or i tried to get to much from excel.

View Replies!   View Related
Macro To Locate Folder In A Folder And Save
looking for some code to save to a destination

destination address is
C:Documents and SettingsstDesktopOJF

now the problem is OJF has folders named 1 to 500

so if cell d5 = 487 it will need to look in the above desination and then open the folder and save it there.

View Replies!   View Related
Locate Folder From Part Of Folder Name
if it's possible to use XlDialogOpen to open up a folder that you only have part of the name.

For example, say you have the following folder paths:

C:Main FolderSubfolder1Smith,Billy 2413
C:Main FolderSubfolder1Brown,Charlie Ray 2416
C:Main FolderSubfolder1Bunny,B 3619
C:Main FolderSubfolder1Fudd,E-G 1864

What I'm hoping to do is just look for the 4 digit number on the end finding that folder name and opening it up. The name conventions before the 4-digit serial number are quite random. Sometimes it includes their full first name, other times it's just an initial for the first name and other times there are other characters included in the name. The one thing that is constant is the 4 digit serial number on the end.

how I could get the Open dialog box to pop up and have the chosen folder number open?

View Replies!   View Related
If True Show Picture 1 Else Show Picture 2
i m working on a mechanical project , I need to do some modifications to my XLS file that i aint familair with.

View Replies!   View Related
Insert Excel Formula Using VBA......MATCH Function Is What I Want To Insert
I can use the MATCH function when i am in excel but i am having trouble getting it to work when i am trying to insert the formula using VBA.

Here is the code i have but it wont even compile........

View Replies!   View Related
Picture In A Picture
I have several pictures on a graph sheet (i.e. imported cliparts) which I am using as a key to describe outcomes. I also have a blank picture box which I want to show each of the key pictures depending on a certain value in a cell on another sheet.

In Picture1 i want: fx = If(sheet1!A1 = "Red",Picture2,Picture3)

View Replies!   View Related
Picture Macro ...
I copied this from another post and am having trouble getting it to work for me. I want to be able to run this macro, find a picture on my computer which could be located anywhere and then have it paste in specific cells.

Whenever I run this it lets me find the picture I want and when I select it I get error message that says "compile error" Syntax Error". It then does not put the picture on the sheet.

I tried to zip and attach the work sheet multiple times but keep getting error message and won't let me attach......"forum excel database has encountered a problem" ....

View Replies!   View Related
Put A Picture Into A Formula
I would like to find out how to put a picture into a formula so that when: example if A1 equals a certain number then a picture will pop up on the worksheet.

So in otherwords - a picture will automaticly pop up - so I need a formula to include the picture.

View Replies!   View Related
Picture On Mouse Over
Is there a way to have a picture set to a cell so when you put your mouse on it it will popup like the comments do.

View Replies!   View Related
Picture Won't Delete
I am working with a spreadsheet created by a predecessor and there is a picture at the top of one of the worksheets. When I select the picture and hit Delete, it seems to work, but the picture is still there. When I move it around the worksheet and resize it, a copy with the same name ("Picture 47") remains in the spot I moved it from. When I delete the resized/moved picture, it deletes, but the picture still remains in the original spot.

When I record a macro and select the picture and hit delete - or even when I move the picture and resize it - the recorded macro is blank.

All of the pictures seem to be named "Picture 47"

View Replies!   View Related
Load Picture
I have made the next code

Filename = Application.GetOpenFilename("JPG Files(*.jpg),*.jpg,GIF files(*.gif),*.gif")
If Filename = False Then
Response = MsgBox("Er was geen file gekozen!", vbOKOnly & vbCritical, "Er is iets fout gegaan")
Exit Sub
End If

Userform.Image1.Picture = LoadPicture(Filename)

I can choose a picture and it will be vissible in the Userform.

The problem is it's not saved into the userform it self.
How can i make it so that when i choose a picture it's also the picture i see the next time i open the userform.

View Replies!   View Related
Can You VLOOKUP A Picture
If I had a series of pictures in a worksheet, how could I give them a value so I could use the vlookup function?

View Replies!   View Related
Un-shrinking Picture
Is it possible after inserting a picture in Excel and then shrinking it to the cell size un-shrink it to the original size by clicking the picture or placing cursor on the cell?

View Replies!   View Related
Use Picture Name From A Cell
I have recorded a macro for inserting, sizing and positioning a product photo into a report. The photo file is in a directory containing many files. Filenames are alpha numeric codes with a .jpg extensions. I wish to be able to enter a different code into a spreadsheet cell which will be named and let the macro insert the proper photo from the files in the subdirectory.

Here is the code which was recorded and which brings up the photo for file "HGGA134.jpg ".

ActiveSheet.Pictures.Insert( _
"C:Documents and SettingsRichard WrightDesktopNUEVOProduct PhotosHGGA134.jpg" _
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 195#
Selection.ShapeRange.Width = 180#
Selection.ShapeRange.Rotation = 0#
End Sub

I need a way to change the "HGGA134" part of the code by having it reference a named cell in the report.

View Replies!   View Related
Togglebutton Picture Input
I'm new with vba and trying to make a Togglebutton to show a picture when pressed and stays empty when depressed in a designated cell (H16).

View Replies!   View Related
How To Open .jpg Picture With Macro
I use the following macro to open excel files. Can this be modified to open a picture ppppp.jpg?

. . . or, can someone help me with a new macro that can open pictures

. . . I would still like to have the file checking options to see if the picture is already open and if not, that it actually exists.

View Replies!   View Related
Copy Chart As A Picture
I’m trying to copy a chart as a Picture but when I select Shift Edit as Jon Pelltier suggests at

In the Copy Picture dialog box it doesn’t appear the “Format” option (to enable Picture copy).

Why is this happening?.

Currently using Excel XP.

View Replies!   View Related
Copy And Pasting A Picture IF
I would like a macro that would analyze a range (H15:GI15) to see if they contain FH, FS, FB, FR, or FC and if they do, copy the related picture associated with the 5 variables and paste it in the cell.

I did this code and it worked, but the code is very long. Another problem I have is there needs to be a way to delete the existing pictures before the code runs too. Because the cells may change and the button that runs the macro would be labeled "update" or something to that effect. I don't really need it to run everytime the cell is updated, just when the "update" button is pushed.

View Replies!   View Related
Copy A Picture From On Location To Another On The Same HD
First of all, I would like to thank all Excel Forum Moderators and Members especially Andy Pope for the great effort they exert to help all members.

Lately, I viewed the thread available on the following link and I admired the great perfect work and codes provided by Andy Pope so much,

My request is similar to the points discussed in the above mentioned thread, but, it is a little bit different ..

Instead of inserting the picture to the worksheet, I want the picture to be copied from one folder on the HD to another folder called (Employees photos), which is located in workbook's path.

In other words, I need a code to copy one jpg picture from one location to another.

View Replies!   View Related
Loading Background Picture
I have a dropdown box with a few options in it. What I want to do, is have excel load a particular picture, that I have saved on my computer, into the background when a certain option is selected from the dropdown box.

View Replies!   View Related
Picture When Combo Box Is Changed
This is the first VBA project i've done on Excel, and its not very big. I've never done any programming before, but i need help on this

What i'm trying to do it to have the Combo box that when an item is selected the respective picture shows next to it (i've got a seperate sheet with the products, prices, pics etc...)

After trying everything to get the picture to show, i switched to VBA because it looked like i could do it in that. The first thing i did was record a macro for each picture - the first one goes like this (its called TEST)

View Replies!   View Related
Selecting A Picture Object
On one sheet I have a table of contents that has a name in column A. In column B I currently have a hyperlink to some text to take me to a cell under a drawing object in another sheet. I wanted to make this more elegant and easier to see which object you are supposed to look at. To do this I thought of using VBA and anchoring a text box in column B of the TOC sheet that I could attach a macro to. Below is my code but it means I need a separate macro for each object. I have 200 and counting. The text in the adjacent cell in column A contains the name. Is there some way for the macro to know what row the control object is in so that it can get the name from the adjacent cell?

Second question. Is there a routine like .OnSelection where I could change the background color of the object only when it is selected? So when another object is selected the previous one reverts back to the original condition.

View Replies!   View Related
Macro For Pop-up Window With Picture
A macro, which would allow me to click on a particular cell, which will have an ID number (1 through 34), each ID# is attributed to a particular employee. These ID# are located in my spreadsheet in columns B & G, and the ID #'s begin initially in B6 & G6 and continue downward to B34 & G34. These ID #'s are used in a vlookup type formula which covers 35 pages of this workbook. What I'd like to do is be able to click on any cell between B6& B34 (and/or the same in G6&G34), which has a particular ID # in it and have the photo of that particular employee designated with that ID# pop up in a window generated by the macro. I hope this makes sense! Any help would be greatly appreciated. My 1st sheet in my workbook is my "lookup" tab, which contains my ID# list and numbering sequence affiliated to each employee. So I'm not sure if I'd need to put the photograph of the employee in a column next to the employees name or have a folder designated with all my pictures in a certain directory, etc.

View Replies!   View Related
Macro: Does Picture Exist
I have been able to piece together something that works great for me till i tested it on a item that I did not have a picture referanced to it.

I am looking for some help with what i guess is an "if" statement that if no picture is found paste "Sorry no picture found" in c3.

Here is code

Sub Copy_Cells()
'Copying the row
addr = ActiveSheet.Shapes(Application.Caller).TopLeftCell.Address
Intersect( Range(addr).EntireRow, Range("b:ak")).Select
Selection.Copy Sheet2.Range("b65536").End(xlUp).Offset(0, 0)

'Picture code
MyPicturesName = Sheets("sheet3").Range("i5").Text

'hide tabs
ActiveWindow.SelectedSheets.Visible = False

End Sub

View Replies!   View Related
Format A Picture With A Macro
I'm watching an educational D V D on my computer, and take notes in excel. I repeatedly use the print screen command, then go to excel and paste in the picture, though it is too large. I resize it to 50% and I'm done. What kind of code do I need to use to paste and shrink the picture to 50%? Also, how do I attach a shortcut key to this action (for example Ctrl+M)

View Replies!   View Related
Look For Every Picture And Change It To A JPEG
I have 50 word docs where people have pasted powerpoint slides as pictures but just used copy and paste rather than paste special, this means when pasted the file sizes are massive.

I have an excel spreadsheet with hyperlinks to evry document where the file sizes are massive and its taking up so much file space.

I was wondering if anyone has a macro or can hlp me with one that, when i click on a link to the word doc, it would open the word doc, and change the picture from .ppt to .JPEG then close the word doc when done.

Im not sure if this is even do-able, infact i am probably talking rubbish, but it would save me like 2 weeks if ti was possible.

View Replies!   View Related
Move The Picture Top Of The Sheet
How can I code a Picture so it moves atop a excel sheet?
I dont like the behavior this code runs.
ActiveSheet.Shapes("Picture 1").Select
Selection.ShapeRange.IncrementLeft 0.75

View Replies!   View Related
Way Of Associating A Cell With A Picture
Does anyone know of a way of associating a cell with a picture?

for example, if you click on a button, the picture appears in cell A1?

View Replies!   View Related
Turning On/Off Picture Refresh
I have a workbook that has many Pictures created with the Camera command. I have found that VBA macros in any workbook open at the same time as the one with Pictures run very slowly. Is there a way of temporarily turning off the Picture Refresh within the VBA in the same way as you can turn off automatic formula updating.


View Replies!   View Related
Picture Would Change With The Data
I have a sheet that I use to store machine process data. The way it works is on a main sheet I select the job I need to run and the machine I want to run it in. The sheet adjusts the process to match the machine basicly volumetric formulas and all that works great no problems. But what I would like to do is when I choose a job I would like excel to display a couple pf pictures such as a picture of the part, a picture of the machine with that job set-up in it that kind of thing. Each time I pick a new job the pictures would change with the data.

View Replies!   View Related
Copy Picture As Text
i have this picture of a list of chores..its about 150 different chores long

i can type all of it in..that would take a long time..

but anyway i was wondering if there was a way to take the picture and turn it into words..


A1 Sweep Kitchen Floor
A2 Mop Kitchen Floor
A3 Empty Dishwasher
A4 Fill Dishwasher

View Replies!   View Related
Resize And Delete Picture
1.My macro code to insert picture from C:pictures to worksheet in colum B,but the insert pictue are very big. how can it is automatic resize with autofit in the height of the column B when i click the insert button.

2.I need some code for the delete button. if I need to delete some picture,when the delete button is clicked , the input box prompt for key in the picture name to delete. if i key in the pictue name , eg.pictue2 , so the name of pictue2 in the column A and the pictue2 in the column B is deleted.

View Replies!   View Related
Copyright © 2005-08, All rights reserved