#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 173
Default Excel & pictures

I have an excel spereadsheet containing information about members of a club
which is maintained and a folder with pictures of all members including those
who left some years ago. I have 2,000 members in excel but some 4,000
pictures, the file name of the picture matches the membership number, how do
I delete the obsolete member pictures automatically without manually do it?

tia
--
neil
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Excel & pictures

Hi Neil

If you have a member list in Column A of "Sheet1"
You can loop through the pictures in the sheet "shapes" and check if the filename match a member.

this macro delete all pictures that match the member list

Sub ShapesTest()
'Loop through the Shapes collection and use the Type number of the control
Dim myshape As Shape
For Each myshape In Sheets("shapes").Shapes
'13 =Picture
If myshape.Type = 13 Then
If Not IsError(Application.Match(myshape.Name, _
Sheets("Sheet1").Columns("A"), 0)) Then
myshape.Delete
End If
End If
Next myshape
End Sub

--
Regards Ron de Bruin
http://www.rondebruin.nl



"neil" wrote in message ...
I have an excel spereadsheet containing information about members of a club
which is maintained and a folder with pictures of all members including those
who left some years ago. I have 2,000 members in excel but some 4,000
pictures, the file name of the picture matches the membership number, how do
I delete the obsolete member pictures automatically without manually do it?

tia
--
neil



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,290
Default Excel & pictures

I made a different assumption about where the pictures are.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

Sub CopyCurrentPictureFiles()
'Jim Cone San Francisco, USA October 2006
'Copies files in worksheet list to another folder.
Dim strFromPath As String
Dim strToPath As String
Dim strName As String
Dim rngCell As Excel.Range
Dim rngList As Excel.Range
Dim Fso As Object
Set Fso = CreateObject("Scripting.FileSystemObject")

'User must select the list of good pictures before running this code.
'Names in list must exactly match the file names in the directory/folder.
Set rngList = Selection

'File path to the folder with the pictures.
strFromPath = "C:\Documents and Settings\My Documents\My Pictures\"

'User must create a new folder before running this code.
strToPath = "C:\Documents and Settings\My Documents\My Current Pictures\"

'Copies files to the new folder.
For Each rngCell In rngList
strName = rngCell.Value
'False prevents overwriting of files
On Error Resume Next
Fso.CopyFile strFromPath & strName, strToPath & strName, False
On Error GoTo 0
Next 'rngCell

'Technically not required, but I prefer it.
Set Fso = Nothing
Set rngCell = Nothing
Set rngList = Nothing
End Sub
'--------------




"neil"
wrote in message
I have an excel spereadsheet containing information about members of a club
which is maintained and a folder with pictures of all members including those
who left some years ago. I have 2,000 members in excel but some 4,000
pictures, the file name of the picture matches the membership number, how do
I delete the obsolete member pictures automatically without manually do it?
tia
--
neil
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Excel & pictures

I made a different assumption
I think you are right Jim after reading it again

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Jim Cone" wrote in message ...
I made a different assumption about where the pictures are.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

Sub CopyCurrentPictureFiles()
'Jim Cone San Francisco, USA October 2006
'Copies files in worksheet list to another folder.
Dim strFromPath As String
Dim strToPath As String
Dim strName As String
Dim rngCell As Excel.Range
Dim rngList As Excel.Range
Dim Fso As Object
Set Fso = CreateObject("Scripting.FileSystemObject")

'User must select the list of good pictures before running this code.
'Names in list must exactly match the file names in the directory/folder.
Set rngList = Selection

'File path to the folder with the pictures.
strFromPath = "C:\Documents and Settings\My Documents\My Pictures\"

'User must create a new folder before running this code.
strToPath = "C:\Documents and Settings\My Documents\My Current Pictures\"

'Copies files to the new folder.
For Each rngCell In rngList
strName = rngCell.Value
'False prevents overwriting of files
On Error Resume Next
Fso.CopyFile strFromPath & strName, strToPath & strName, False
On Error GoTo 0
Next 'rngCell

'Technically not required, but I prefer it.
Set Fso = Nothing
Set rngCell = Nothing
Set rngList = Nothing
End Sub
'--------------




"neil"
wrote in message
I have an excel spereadsheet containing information about members of a club
which is maintained and a folder with pictures of all members including those
who left some years ago. I have 2,000 members in excel but some 4,000
pictures, the file name of the picture matches the membership number, how do
I delete the obsolete member pictures automatically without manually do it?
tia
--
neil



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
unhide menu bar in excel - just disappeared Sean Setting up and Configuration of Excel 12 April 4th 23 10:19 AM
Link pictures in Excel 2003 doesn't work! ODI Excel Discussion (Misc queries) 4 November 5th 05 02:23 PM
TRYING TO SET UP EXCEL SPREADSHEET ON MY COMPUTER MEGTOM New Users to Excel 5 October 27th 05 03:06 AM
Compressing Pictures in Excel Broadband Al Excel Discussion (Misc queries) 0 October 14th 05 12:35 PM
how do I embed/Link pictures onto excel database cells? a0relento Excel Discussion (Misc queries) 0 October 14th 05 05:27 AM


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

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

About Us

"It's about Microsoft Excel"