- ©«¤l
- 2833
- ¥DÃD
- 10
- ºëµØ
- 0
- ¿n¤À
- 2889
- ÂI¦W
- 0
- §@·~¨t²Î
- ¡e²¤¡f
- ³nÅ骩¥»
- ¡e²¤¡f
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¡e²¤¡f
- µù¥U®É¶¡
- 2013-5-13
- ³Ì«áµn¿ý
- 2024-11-16
|
1) ¬Ý¬O3±i¹Ï???
2) n¾Ç·|¨Ï¥Î¤W¶ÇªþÀÉ, ¤è«K§O¤H¤U¸ü
Sub ´¡¤H¹Ï¤ù()
Dim i%, P$, N$(3), xR As Range, xS, Shp As Shape
'¸ô®|»P¸ê®Æ§¨ÀË´ú
P = ThisWorkbook.Path & "\«È¤á¦WºÙ¹ÏÀÉ"
If Dir(P, vbDirectory) = "" Then MsgBox "¡e«È¤á¦WºÙ¹ÏÀÉ¡f¸ô®|¿ù»~©Î¸ê®Æ§¨¤£¦s¦b! ": Exit Sub
For Each xR In [A3:C3]
If xR = "" Then MsgBox xR(0) & "¥¼¿é¤J! ": Exit Sub
If xR(0) <> "½s¸¹" Then P = P & "\" & xR Else N(0) = xR
If Dir(P, vbDirectory) = "" Then MsgBox "¡e" & xR(0) & "¡f¸ô®|¿ù»~©Î¸ê®Æ§¨¤£¦s¦b! ": Exit Sub
Next
'¹Ï¤ùÀÉ®×ÀË´ú
For i = 1 To 3
N(i) = N(0) & -i & ".jpg"
If Dir(P & "\" & N(i)) = "" Then MsgBox "§ä¤£¨ì¡e" & N(i) & "¡f¹Ï¤ùÀÉ®×! ": Exit Sub
Next i
'¸ü¤J¹ÏÀɨýվã¤j¤p¤Î¦ì¸m
xS = Array("A11", "E11", "I11")
For i = 1 To 3
Set xR = Range(xS(i - 1)).Resize(9, 4) '¹Ï¤ù©ñ¸mªº½d³ò
Set Shp = ActiveSheet.Shapes.AddPicture(P & "\" & N(i), 0, 1, xR.Left, xR.Top, -1, -1)
If Shp.Height > xR.Height Then Shp.Height = xR.Height - 2 '½Õ¾ã¹Ï¤ù°ª«×
If Shp.Width > xR.Width Then Shp.Width = xR.Width - 2 '½Õ¾ã¹Ï¤ù¼e«×
Shp.Top = xR.Top + (xR.Height - Shp.Height) / 2 '½Õ¾ã¹Ï¤ù¤WÃä¬É(¤W¤U¸m¤¤)
Shp.Left = xR.Left + (xR.Width - Shp.Width) / 2 '½Õ¾ã¹Ï¤ù¥ªÃä¬É(¥ª¥k¸m¤¤)
'Kill P & "\" & N(i) '§R°£¹Ï¤ùÀÉ®×
Next i
End Sub
TEST_v1.rar (1.63 MB)
======================================== |
|