Insert Picture Code Not Working In 2007
Aug 18, 2009
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
GetPict:
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
Range("C2").Select
Set PictObj = ActiveSheet.Pictures.Insert(oPict)
With PictObj
.ShapeRange.LockAspectRatio = msoFalse
.ShapeRange.Width = 712#
.ShapeRange.Height = 510#
End With
PictObj.Select
With PictObj
Selection.ShapeRange.IncrementLeft 1#
Selection.ShapeRange.IncrementTop 1#
End With
Range("A1").Select
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 9 Replies
ADVERTISEMENT
Aug 18, 2009
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:
ActiveSheet.Pictures.Insert("c:1.jpg").Select
View 5 Replies
View Related
Mar 5, 2009
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 3 Replies
View Related
Feb 14, 2012
So far my VBA will copy my range of cells in Excel and paste them into Powerpoint but I'm totally stuck as to how to resize the image from there. I've tried a bunch of different methods and I get some pretty crazy results but can't seem to punch through to a solution. What I'd like it to do, at the end of the VBA is:
Set the lock aspect ratio to false
Set the Height to 5.5"
Set the Width to 9.83"
Set the horizontal position to .08 from Top Left
Set the Vertical position to .58 from Top Left
I cannot seem to get my save as portion to work at all. I commented it out at the bottom. This is all in Excel and PPT 2007.
Here is what I have so far:
Sub Export_Excel_to_PowerPoint()
Dim ppApp As PowerPoint.Application
Dim ppSlide As PowerPoint.Slide
On Error Resume Next
Set ppApp = GetObject(, "PowerPoint.Application")
On Error GoTo 0
[Code]...
Ultimately the behavior I'm looking for with this macro is to copy a filtered range of cells from Excel and paste it as a picture into Powerpoint (up til this point I'm golden) then resize the image on the slide, save the presentation, then exit PPT.
View 1 Replies
View Related
Mar 14, 2013
how to write vba code using vlookup formula insert pic from picture folder
View 5 Replies
View Related
Mar 17, 2009
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 9 Replies
View Related
Jan 14, 2014
The amazing code I saw was from this thread Auto lock cells after data entry when file saved... where the code was made by Jafaar Tribak.
It basically locks cells that have had data inputted into them when the file is saved (with a nice prompt warning of the used cells being locked.
This is Jafaar's file [URL]
And this is my file where I'm trying to make it work in the "Employee data entry" Sheet:
[URL]
And finally this is the file after I tried to copy the code over : [URL]
Trying to make it so that in the employee data entry sheet locks cells after an employee inputs some data into said cells.
I thought that by setting an "inputrange" on the employee data entry sheet the code would track it down automatically but maybe I'm completely wrong. I cant see anything wrong with it (probably because I"m not that good at vba) but I fear I may have left out something really simple!
I seem to disable my other macros when i try to insert this code in (I have a macro that when you click on a cell a calendar pops up so you can click on a day from the calendar rather than typing out the date)
View 9 Replies
View Related
Jan 25, 2010
I have a workbook in excel 2003 which I had been running the following macros (listed below). We recently upgraded to Excel 07, and neither are working. When I try to run them, the "debug" option highlights the following line in the sort macro "Range("A2:z" & lastcell).Sort key1:=.Columns(1)". This is driving me crazy, as the macros worked perfectly under the older version of Microsoft. Is there an issue with crossfunctionality between '03 and '07'.
Private Sub Worksheet_change(ByVal target As Excel.Range)
If target.Column = 1 Then
ThisRow = target.Row
startRow = 1
i = 1
Set ws = ActiveSheet
maxRow = Cells.SpecialCells(xlLastCell).Row
maxCol = Cells.SpecialCells(xlLastCell).Column
ActiveSheet.UsedRange.Interior.ColorIndex = xlNone
Do While i
View 9 Replies
View Related
May 12, 2014
how i can add a box on my sheet when i click on it to open the insert picture (or open picture). I need this for my recipes. I try the Image (Image ActiveX Control) but i do not now how to make it work. Also i try to insert picture each time but it takes me time to move it and re-size it every time. I need a faster way to add my pictures fast and in the same position every time.
View 5 Replies
View Related
Sep 8, 2009
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 14 Replies
View Related
Jul 11, 2009
1st thing id like to know. is there any way to inset a picture (not using the background button coz i dont want to tile the pic) and then be able to work ontop of it?
2nd is there a formula to change the order of a list depending on the number (high to low) in 1 of my other box's
3rd how do i take a result from one page and copy it automaticly to another?
View 14 Replies
View Related
Dec 31, 2009
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 6 Replies
View Related
Sep 4, 2012
I have a approximately 17 workbooks, all with multiple worksheets within. I have a logo that I now want to add to each worksheet in every book.
What I would like to do is the following, on each worksheet.
Add 13 rows starting from the top A1 (this is to make room for a logo I want to add)Add the logo JPG file (which covers the range A1:F13) . This will be the same picture for all sheets. The picture properties should be "Locked" and "Don't move or size with cells". The path of where my logo is stored is C:UsersGrantDropboxEffExAdminLogosEffEx_logo-05Then select the entire contents of the workbook and uncheck "Locked" from the format control.Then apply protection (which leaves the picture locked) but allowing selection, inserting and formatting of rows/columns.
This will allow the users to still format columns and rows eg. autofit columns, but they cannot select and delete the logo.
I have tried using the Macro Recorder but when I select all sheets, I see that it records the actual sheet names and so this will obviously not work for when applying to other workbooks. Also, it did not record any of the Protection commands which I did.
how I can do this?
View 9 Replies
View Related
Jan 9, 2007
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
Picture
Millenium Copthorne InternationalTVGI Race Name Logo
Picture
Sub TestInsertPictureInRange()
InsertPictureInRange "Z:SingaporeSingapore TurfSingapore Turf Club 2QEII Cup 2006QEII Cup 2006_VDMillenium Copthorne InternationalTVGI Race Name Text3965.jpg", _ .........................
View 4 Replies
View Related
Apr 18, 2014
The following macro enables be to insert picture from a given location. My query is I want to insert the picture name once the pictures are inserted in the excel worksheet.
[Code] .....
View 3 Replies
View Related
Jan 8, 2007
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
Picture
Millenium Copthorne InternationalTVGI Race Name Logo
Picture
View 14 Replies
View Related
Oct 7, 2009
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 2 Replies
View Related
Nov 22, 2013
I am inserting a picture into a cell and resizing it to fit the cell. The problem I am having is that the cell covers the border at the top of the cell. Is there a way I can offset the picture in the cell so it does not cover the border?
Code:
Sub Sig()
Dim filselect As String
ActiveSheet.Unprotect Password:="159357"
filselect = Application.GetOpenFilename( _
FileFilter:="Picture Files (*.png;*.jpg),*.png;*.jpg", _
[Code] ........
View 2 Replies
View Related
Dec 31, 2006
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 9 Replies
View Related
Jun 17, 2009
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 9 Replies
View Related
Dec 14, 2007
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 7 Replies
View Related
Mar 27, 2013
Can I have a picture appear next to what is typed in the cell next to it. I have a drop down list of the different pictures I have, I want to select, for example, "star" from the drop down list, can I have a picture of the star appear in cell next to it? I have all the pictures of the words in my drop down list.
View 1 Replies
View Related
Jul 20, 2014
I've got a table in a worksheet. Every time the user double-clicks on one of the cells containing the names for each of the listed items, a userform pops up displaying information about that item. Besides other controls, this userform has an Image Box, that displays a picture of the item, and a Multipage.
What I want to do is to display the same picture shown by the Image Box, on to the Multipage, using the same file, but, and here's the quirk, aditionally, change it's size, turn it monochrome, and set its transparency to a different value.
I've attached an example of the final look I'm seeking. This was done by prior editing of a copy of the image and inserting it using LoadPicture, but this solution is too troublesome as this is done solely for aesthetical purposes, thus not justifying all the hassle a user has to go through everytime he wishes to add a new item to the table.
View 1 Replies
View Related
Feb 24, 2011
I have to file an insurance claim due to a fire in my home. I have a folder with .jpg photos located at C:InsClaimOnlinePhotos . Im working with Excel 2003. I am trying to put the picture of the damaged protery in Column A on the same row as the detail about that damaged property using the ActiveSheet.Pictures.Insert function. The name of the picture is located in Column B. There are multiple sheets in the Excel book and each contains from 10 to over 700 rows. I would like to run the macro based on the active sheet to add the pictures one sheet at a time. I would like the pictures to be about 1.2" High by 1.6" Wide and be actually be within the cell of Column A of the row where the detail information is located. I have played with writing my own code, pieces of others code and full code sets I found in the Forum. Nothing works. Below is the best I found so far but, it uses Column C for the placement of the pictues.
When I try to run the below code I get Run-Time Error "1004" "Unable to get the insert Property of the Picture class".
I'm not sure if this code should work in Excel 2003 or not.
View 11 Replies
View Related
Apr 19, 2009
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 2 Replies
View Related
Feb 5, 2013
I'm using a macro to insert a photo in to a Excel 2010 workbook. If the photo moves location it will no longer display the photo in the document as I belive the photo is being referenced instead of embedded.
If you then use the "Change Picture" icon the photo embeds but how do I get my macro to embed the photo.
Sub InsertPhoto(PictNo)
Dim SH As Worksheet
Dim Rng As Range
Dim MyPic As Picture
Dim sPath As String
Dim PicH As Single
[Code] ......
View 1 Replies
View Related
Jun 7, 2014
Basically, I am curious if I were to insert a value into say cell A1, is there any way B1 could display a picture I've saved. To be a bit more specific, A1's value would be 777, and B1's inserted picture would be 777.png saved on my PC. This would need to apply for the whole of the sheet for all the values in column A.
View 5 Replies
View Related
Feb 10, 2007
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 2 Replies
View Related
Mar 24, 2007
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 7 Replies
View Related
Aug 21, 2007
The following works perfect in 2003.
Private Sub CommandButton1_Click()
Dim shpTemp As Shape
Set shpTemp = Worksheets("Sheet3").Shapes(ListBox1.Value)
shpTemp.Copy
With Worksheets("Sheet1")
.Activate
. Range("A1").Select
.Paste
Set shpTemp = .Shapes(.Shapes.Count)
shpTemp.Fill.UserPicture ListBox2.Value
End With
End Sub
However, when run in excel 2007 the shape is not filled. If you right click the shape, format shape and click on the "Picture or texture fill" it will fill the shape with the previously selected picture in the userform. I have tried by adding
shpTemp.UserPicture.Fill.Visible = True....................
View 9 Replies
View Related