¥»©«³Ì«á¥Ñ a703130 ©ó 2012-12-5 10:32 ½s¿è
¤U±¬O§Úªº¤@³¡¥÷µ{¦¡½X,¥Ø¼Ð¬O±qa.xls§ìÀɮצWºÙ,¦A¥h¸ê®Æ§¨¤º§ì¨ú¹ÏÀÉ,קï¤j¤p«á©ñ¦^a.xlsÀÉ
¥Ø«e¹J¨ì¤@Ó°ÝÃD,´N¬O·í§Úa.xls§ì¤FÀɮצWºÙ,¦ý¬O¸ê®Æ§¨¤º¨S¦³ÀÉ®×,§Ú¸Ó¦p¦ó§PÂ_
¬O§_¦b²Ä15¦æ«e¥[¤J¤@§PÂ_¦¡,§PÂ_ÀɮצWºÙ¬O§_¦s¦b©ó¸ê®Æ§¨,¦pªG¨S¦³«hÂ÷¶}if §PÂ_¦¡
§PÂ_Àɮ׬O§_¦s¦b,³o³¡¤À§Ú¤£ª¾¹D¦p¦ó¼g~¬O§_¯à½Ð«e½úÀ°¦£,·P¿E¤£ºÉ- Sub InsertImage(ImagePath, FolderName)
- Dim ReadRow As Integer
- Dim ImageName As String
- Sheets("a").Select
- ReadRow = 24
-
- '§PÂ_Safety¶±²Ä¤@Äæ¬O§_¦³»Ýn¸ü¤J¹ÏÀɪ½¦Ü¥X²{"END"¦r¼Ë
- Do Until UCase(Cells(ReadRow, 1)) = "END"
- ImageName = Cells(ReadRow, 1)
-
- '§Q¥ÎCheckFileName func ¨Ó§PÂ_¬O§_¦³ÃöÁä¦r ".PNG & .JPG"¡A¦pªG¦³«h¸ü¤J¹Ï¤ù
- If CheckFileName(UCase(ImageName)) = True Then
- Cells(ReadRow, 2).Select
- ActiveSheet.Pictures.Insert(ImagePath & "\" & FolderName & "\" & ImageName).Select
- Call ImageSize
- Else
- End If
- ReadRow = ReadRow + 1
- Loop
- End Sub
- Function CheckFileName(ByVal ImageName As Variant) As Boolean
- Dim ImageLenth As Integer
- Select Case ImageName
- '¦pªGªÅ¥Õ«hÂ÷¶}¦¹ func
- Case Is = ""
- CheckFileName = False
- Exit Function
- 'pºâ¦r¦êªø«×¨ÃÂ^¨ú«á±4Ó¦r¤¸¡A§PÂ_¬O§_¦³ÃöÁä¦r ".PNG & .JPG"¡A¦pªG¦³«h¸ü¤J¹Ï¤ù
- Case Else
- ImageLenth = Len(ImageName)
- ImageName = Mid(ImageName, ImageLenth - 4 + 1, 4)
- If ImageName = ".PNG" Or ImageName = ".JPG" Then
- CheckFileName = True
- Else
- CheckFileName = False
- End If
- End Select
- End Function
- '³]©w¹ÏÀɪºSize¤j¤p¤Î¦ì¸m
- Sub ImageSize()
- Selection.ShapeRange.LockAspectRatio = msoFalse
- Selection.ShapeRange.Height = 289.5
- Selection.ShapeRange.Width = 531.75
- Selection.ShapeRange.Rotation = 0#
- Selection.ShapeRange.IncrementLeft 5#
- Selection.ShapeRange.IncrementTop 5#
- End Sub
½Æ»s¥N½X |