- ©«¤l
- 29
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 42
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- OFFICE 2003
- ¾\ŪÅv
- 10
- µù¥U®É¶¡
- 2012-9-22
- ³Ì«áµn¿ý
- 2013-1-9
|
¦^´_ 9# c_c_lai
À°§Ú¬Ý¤@¤U
§Ú·Qn¦bAÄæBÄæ©ñ¦ì§}
CÄ欰¹Ï¤ùÀɦW
DÄ欰Åã¥ÜAªº¹Ï¤ù
EÄæÅã¥ÜBªº¹Ï¤ù
¨Ï¥ÎFOR °j°é
¹Ï¤ù·|¦bDÄæ«Å|
¸Ó«ç»ò§ï©O
Option Explicit
Sub Ex()
Dim j As Integer, MyPath As String, MyFile As String, k, l
For k = 1 To 2
For l = 4 To 5
j = 2
While Cells(j, "C") <> "" 'C2¬°ÀɦW
MyPath = Cells(j, k) 'A2 B2¬°¦ì§}
If UCase(Cells(j, "C")) Like "*W*" Then '¦r¦ê¤¤¦³"ABCD"
' UCase ¨ç¼Æ ¶Ç¦^¤@Ó Variant (String)¡A©Ò§t¬°Âন¤j¼g¤§¦r¦ê¡C
Cells(j, l).Select 'D2 E2¬°¹Ï¤ù
On Error Resume Next
MyFile = Dir(MyPath & "*" & Cells(j, "C") & "*.*") ' C2 = "ABCD" ->"1AABCD.png"
If MyFile <> "" Then
With ActiveSheet.Pictures.Insert(MyPath & MyFile)
' .ShapeRange.LockAspectRatio = msoTrue
' ¦b½Õ¾ã¹Ï®×¤j¤p®É¡A¥i¥H¤À§O¦a½Õ¾ã¹Ï®×ªºªø«×©M¼e«×
.ShapeRange.LockAspectRatio = msoFalse
.ShapeRange.Height = 100#
.ShapeRange.Width = 100#
.ShapeRange.Rotation = 0#
.Placement = xlMoveAndSize
.PrintObject = True
End With
End If
End If
j = j + 1
Wend
Range("C2").Select
Next
Next
End Sub |
|