Offthefield
Gebruiker
- Lid geworden
- 27 apr 2005
- Berichten
- 369
Ik heb een excelbestand waarin ca. 30 foto's (hier vb. van 5 foto's) dmv van een knop ingeladen moeten worden,
aan de hand van artnrs in B3,B5 ect., hier wil ik een verkorte macro-versie van maken, maar alleen ik weet niet hoe, heeft iemand een idee?
Hieronder staat mijn macro voor 5 foto's :
Private Sub Fotphalen_Click()
'
'
Bestandsnummer1 = Range("B3")
Bestandsnummer2 = Range("B5")
Bestandsnummer3 = Range("B7")
Bestandsnummer4 = Range("B9")
Bestandsnummer5 = Range("B11")
'
Bestandsnaam1 = "C:\Users" & Bestandsnummer1 & ".jpg"
Bestandsnaam2 = "C:\Users" & Bestandsnummer2 & ".jpg"
Bestandsnaam3 = "C:\Users" & Bestandsnummer3 & ".jpg"
Bestandsnaam4 = "C:\Users" & Bestandsnummer4 & ".jpg"
Bestandsnaam5 = "C:\Users" & Bestandsnummer5 & ".jpg"
'
Image1.Picture = StdFunctions.LoadPicture(Bestandsnaam1)
Image2.Picture = StdFunctions.LoadPicture(Bestandsnaam2)
Image3.Picture = StdFunctions.LoadPicture(Bestandsnaam3)
Image4.Picture = StdFunctions.LoadPicture(Bestandsnaam4)
Image5.Picture = StdFunctions.LoadPicture(Bestandsnaam5)
'
End Sub
aan de hand van artnrs in B3,B5 ect., hier wil ik een verkorte macro-versie van maken, maar alleen ik weet niet hoe, heeft iemand een idee?
Hieronder staat mijn macro voor 5 foto's :
Private Sub Fotphalen_Click()
'
'
Bestandsnummer1 = Range("B3")
Bestandsnummer2 = Range("B5")
Bestandsnummer3 = Range("B7")
Bestandsnummer4 = Range("B9")
Bestandsnummer5 = Range("B11")
'
Bestandsnaam1 = "C:\Users" & Bestandsnummer1 & ".jpg"
Bestandsnaam2 = "C:\Users" & Bestandsnummer2 & ".jpg"
Bestandsnaam3 = "C:\Users" & Bestandsnummer3 & ".jpg"
Bestandsnaam4 = "C:\Users" & Bestandsnummer4 & ".jpg"
Bestandsnaam5 = "C:\Users" & Bestandsnummer5 & ".jpg"
'
Image1.Picture = StdFunctions.LoadPicture(Bestandsnaam1)
Image2.Picture = StdFunctions.LoadPicture(Bestandsnaam2)
Image3.Picture = StdFunctions.LoadPicture(Bestandsnaam3)
Image4.Picture = StdFunctions.LoadPicture(Bestandsnaam4)
Image5.Picture = StdFunctions.LoadPicture(Bestandsnaam5)
'
End Sub