Automatically inserting images in excel using a button (excel 2007)__
Hi all, I have had help with this already...
I am now trying to automatically insert the images next to the product ID number when a button is pressed.
Any one can help this would be much appreciated.
Sub InsertPictures()
'change this to the full path to your picture files
Const pathToPictures = "C:\images\"
Dim listOfFiles As Range
Dim anyFileEntry As Range
Dim picFileName As String
Dim startingPoint As Range
Set startingPoint = ActiveSheet.Selection
Set listOfFiles = ActiveSheet.Range("A2:" & _
ActiveSheet.Range("A" & Rows.Count).End(xlUp).Address)
Application.ScreenUpdating = False
For Each anyFileEntry In listOfFiles
'change .jpg to whatever graphic file type you're using
' or delete the & ".jpg" portion if those files have no
' file type indicator.
picFileName = pathToPictures & anyFileEntry & ".jpg"
'code to insert the graphic here, and you can reference
'the same-row cell in column B using .Offset
anyFileEntry.Offset(0, 1).Select
'or you can use this command format if you like;
'this would insert in column D on same row
'ActiveSheet.Range("D" & anyFileEntry.Row).Select
'this does not do any resizing, so pictures may
'overlap unless your sheet is already set up to
'display them the way you want.
ActiveSheet.Pictures.Insert(picFileName).Select
Next
Set listOfFiles = Nothing
startingPoint.Select
Set startingPoint = Nothing
End Sub
Anwsers to the Problem Automatically inserting images in excel using a button (excel 2007)__
Download SmartPCFixer to Fix It (Free)
Try this, which attempts to fit the picture in the cell to the right of the part number.
If it does some scaling you don't want then delete the rows setting width / height.
Sub InsertPictures()
'change this to the full path to your picture files
Const pathToPictures = "C:\images\"
Dim listOfFiles As Range
Dim anyFileEntry As Range
Dim picFileName As String
Dim startingPoint As Range
Set startingPoint = ActiveSheet.Selection
Set listOfFiles = ActiveSheet.Range("A2:" & _
ActiveSheet.Range("A" & Rows.Count).End(xlUp).Address)
Application.ScreenUpdating = False
For Each anyFileEntry In listOfFiles
'change .jpg to whatever graphic file type you're using
' or delete the & ".jpg" portion if those files have no
' file type indicator.
picFileName = pathToPictures & anyFileEntry & ".jpg"
ActiveSheet.Pictures.Insert(picFileName).Select
With anyFileEntry.Offset(0, 1)
Selection.Top = .Top
Selection.Left = .Left
Selection.Width = .Width
Selection.Height = .Height
End With
Next
Set listOfFiles = Nothing
startingPoint.Select
Set startingPoint = Nothing
End Sub
Bill Manville.
Excel MVP, Oxford, England.
www.manville.org.uk
Make Sure that your Computer Meets the System Requirements
Microsoft Windows Requirements :
- 1 gigahertz (GHz) or faster 32-bit (x86) or 64-bit (x64) processor
- 1 gigabyte (GB) RAM (32-bit) or 2 GB RAM (64-bit)
- 16 GB available hard disk space (32-bit) or 20 GB (64-bit)
This error can be due to some configuration requirements for you system. If your PC hardware is not up to par, then make sure you update where necessary before continuing.
Recommended Method to Fix the Problem: Automatically inserting images in excel using a button (excel 2007)__:
How to Fix Automatically inserting images in excel using a button (excel 2007)__ with SmartPCFixer?
1. Click the button to download SmartPCFixer . Install it on your computer. Open it, and it will perform a scan for your system. The junk files will be shown in the list.
2. After the scan is finished, you can see the errors and problems need to be fixed. Click Fix All.
3. The Fixing part is finished, the speed of your computer will be much higher than before and the errors have been removed.
Related: AMD Radeon HD 7800M Win8 not working [Anwsered],I can access the internet, get on facebook and get to hotmail, but I can't play games on facebook and I can't open or respond to my e-mails,I keep getting this Media Player error when I log on my computer. [Anwsered],[Anwsered] System Hanging on shutdown and restart,Unable to get the Vlookup property of the WorksheetFunction class,Solution to Error: Error: "0x81000032 make sure the C: drive is online and set to NTFS" when trying to backup to external hard drive.
,Troubleshoot:External Hard Drive not listed in Windows 7 backup wizard Error
,I'm always being signed off so annoying Tech Support
,Solution to Problem: Impossible to use Internet Explorer! I keep getting the same error message every time i try to use IE.
,Solution to Problem: Referencing data in another file
,Troubleshoot:Error: "0x81000032 make sure the C: drive is online and set to NTFS" when trying to backup to external hard drive. Error,External Hard Drive not listed in Windows 7 backup wizard Tech Support,Tech Support: I'm always being signed off so annoying,Solution to Problem: Impossible to use Internet Explorer! I keep getting the same error message every time i try to use IE.,Referencing data in Access using Excel [Anwsered],Need Best Way To Present Data [Anwsered],Same question but for windows 7 home edition,sometimes fullscreen won't activate [Solved],Solution to Error: We bought a new computer with windows 7 and it is constantly freezing. How do we fix this?,Solution to Error: Windows 8 update crash (2013-07-22)
Read More: How to Fix - Backing up Windows 7 Computer onto Windows XP computer.?,How to Fix Error - Auto Run Module.bas on Excel, HOW??,How Can You Fix - Backup error codes. I had: 0x800703EE,now have: 0x8100002F?,How to Fix Error - AutoPlay Windows 7 64 bit?,Tech Support: Automatically hide entire Rows with zero Values,application not found error,any problems in a team where one has Windows XP and the other has Windows 7?,Application/Object-Defined Error,An Excel formula question where hours are totalled and cumulating,Anyone know the hardware email?
No comments:
Post a Comment