Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default need help importing photos from file folders


I don't even know if anyone is still up...

ActiveSheet.Pictures.Insert(loc1).Select

I have that line of code to insert a photo. loc1 is hardcoded to go to
a certain cell and load the text containing a path.

the path is:

I:\Lab\Perf\Test Reports\For Lab Only\Test Reports for 2004
Requests\P04332\Defrost Pictures\13 5 Volts\Salt Water
Resistance\Sample Number 7 RH\MVC-001F.JPG

where everything after "defrost pictures" could change.

Is there a way to load every photo regardless of how many there are?

I wanted a dynamic way to load all the photos in the "sample number 7
rh" folder, then change only "sample number 8 rh".

thanks,
richard


--
wraithlead
------------------------------------------------------------------------
wraithlead's Profile: http://www.excelforum.com/member.php...o&userid=11578
View this thread: http://www.excelforum.com/showthread...hreadid=271074

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default need help importing photos from file folders

Maybe something like this will get you started:


Option Explicit
Sub testme()

Application.ScreenUpdating = False

Dim myPath As String
Dim iCtr As Long
Dim myRng As Range
Dim myPict As Picture

'change to point at the folder to check
myPath = "c:\my documents\my pictures"

With Application.FileSearch
.NewSearch
'Change this to your directory
.LookIn = myPath
.Filename = ".jpg"
.SearchSubFolders = True
If .Execute() 0 Then
Set myRng = ActiveSheet.Range("a1:b2")
For iCtr = 1 To .FoundFiles.Count
Set myPict = ActiveSheet.Pictures.Insert(.FoundFiles(iCtr))
With myPict
.Width = myRng.Width
.Top = myRng.Top
.Height = myRng.Height
.Left = myRng.Left
.Name = "Pict_" & myRng.Address(0, 0)
End With
Set myRng = myRng.Offset(2, 0)
Next iCtr
End If
End With

Application.ScreenUpdating = True
End Sub



wraithlead wrote:

I don't even know if anyone is still up...

ActiveSheet.Pictures.Insert(loc1).Select

I have that line of code to insert a photo. loc1 is hardcoded to go to
a certain cell and load the text containing a path.

the path is:

I:\Lab\Perf\Test Reports\For Lab Only\Test Reports for 2004
Requests\P04332\Defrost Pictures\13 5 Volts\Salt Water
Resistance\Sample Number 7 RH\MVC-001F.JPG

where everything after "defrost pictures" could change.

Is there a way to load every photo regardless of how many there are?

I wanted a dynamic way to load all the photos in the "sample number 7
rh" folder, then change only "sample number 8 rh".

thanks,
richard

--
wraithlead
------------------------------------------------------------------------
wraithlead's Profile: http://www.excelforum.com/member.php...o&userid=11578
View this thread: http://www.excelforum.com/showthread...hreadid=271074


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transferring Excel Data to Make New File Names for Photos Lamp123 Excel Discussion (Misc queries) 3 December 1st 08 07:11 PM
import photos to specific cells named with file name of photo Vanessa Excel Discussion (Misc queries) 1 September 6th 07 03:56 PM
How to reduce file size of photos inserted in Excel [email protected] Excel Discussion (Misc queries) 3 July 12th 07 08:54 PM
Importing (Exporting) photos into Excel Hard Nut Excel Discussion (Misc queries) 2 November 29th 06 03:20 PM
Inserted Photos - Enormous Excel File Size Steve Lee Excel Discussion (Misc queries) 3 November 13th 06 07:50 PM


All times are GMT +1. The time now is 07:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"