ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] EXCEL2010 §å¦¸¶×¤J¹Ï¤ù,¦ý¤£¬O¥Î³sµ²ªº¤è¦¡

[µo°Ý] EXCEL2010 §å¦¸¶×¤J¹Ï¤ù,¦ý¤£¬O¥Î³sµ²ªº¤è¦¡

¤£¦n·N«ä,¤§«e¦³°Ý¹L°ÝÃD
§Ú·ÓµÛ³o¸Ìªº«e½ú­×§ï,²×©ó¥i¥H§å¦¸¶K¹Ï¤F
¦ý«á¨Óµo²{¬O¥Î³sµ²ªº¤è¦¡,§Ú·Q­nªº¬O¥¦¬O¥Î½Æ»s¶K¤W,µM«á²Å¦XÀx¦s®æ¤j¤p

½Ð°Ý¬O­n­×§ï­þ¸Ì?ÁÂÁ¦U¦ì«e½ú
  1.     Sub ChangeSize()
  2.         Dim Mypath As String, E As Range, MyPic As Object
  3.         Mypath = "C:\Users\Administrator\Desktop\±¼º£\O13\"
  4.         With Sheets("O13")
  5.             .Pictures.Delete
  6.             For Each E In .Range("c3", .Range("c" & .Rows.Count).End(xlUp))
  7.             'For Each  : ¨Ì§Ç³B¸Ì¶°¦Xªº¦¨­û
  8.             '¶°¦Xªº¦¨­û: .Range("a2") ¨ì .Range("a" & .Rows.Count).End(xlUp))ªºÀx¦s®æ
  9.                                          '(±q³ÌÀx¦s®æ©³³¡ªº¦C©¹¨ì¦³¸ê®ÆªºÀx¦s®æ)
  10.                 If Dir(Mypath & E & ".jpg") <> "" Then
  11.                     Set MyPic = ActiveSheet.Pictures.Insert(Mypath & E & ".jpg")
  12.                     With MyPic
  13.                         .ShapeRange.LockAspectRatio = msoFalse
  14.                         .Left = E.Cells(1, 1).Left
  15.                         .Top = E.Cells(1, 1).Top
  16.                         .Width = E.Cells(1, 1).Width
  17.                         .Height = E.Cells(1, 1).Height
  18.                     End With
  19.                 End If
  20.             Next
  21.         End With
  22.     End Sub
½Æ»s¥N½X

§Ñ¤F»¡
lpk187«e½ú¤@¶}©l¼gªº»yªk
¤w¸g§¹¬üªº¸Ñ¨M§Úªº°ÝÃD
¬O§Ú¦Û§@Áo©ú¶¤F¤@¤j°é
¨þ¨þ,·Q¨ì´N¦n¯º
¦n¦b°ÝÃD¤w¸g¸Ñ¨M,¥i³ß¥i¶P

TOP

¦^´_ 6# lpk187


·ÓµÛ§Aªº¤è¦¡¥´,¦b¥b©]¦¨¥\¤F
¬O§Ú¤@¶}©l¨S¿ï¨ì¤u§@ªí
«á¨Ó¤S¦Û§@Áo©ú§ï¤u§@ªíªº¦W¦r¸Õ¸Õ¬Ý

ÁÂÁÂlpk187«e½ú¼ö¤ßÂI¥X§Úªº¿ù»~
·P®¦~~~~

TOP

¥»©«³Ì«á¥Ñ lpk187 ©ó 2015-6-26 17:38 ½s¿è

¦^´_ 4# ¬I«Ø°ê


    ¥D­nªº¸ô®|³£¦b³o¦C
Pat = ThisWorkbook.Path & "\" & Sh.Name & "\" & Rng & ".jpg"
ThisWorkbook.Path==>¥»ÀɮשҦbªº¸ê®Æ§¨
Sh.Name==>¬O¤u§@ªí¤]¬O¸ê®Æ§¨¦WºÙ
Rng & ".jpg"==>¦]¬°§Ú°²³]§Aªº¹Ï¤ù°ÆÀɦW³£¬°JPGÀÉ¡A¦ÓRng«h¬OCÄ檺¹Ï¤ù¥D­nÀɦW¡A­Y§Aªº¹Ï¤ù¤£¬OJPGÀɽЦۦæ§ó§ï¡C
·|²£¥Í¿ù»~¥D­n¬O§AÀɮשιϤù©ñ¿ù¦a¤è¤F¡A©ÎªÌ¬O°ÆÀɦW¤£¬OJPGÀÉ

TOP

¥»©«³Ì«á¥Ñ lpk187 ©ó 2015-6-26 17:27 ½s¿è

¦^´_ 4# ¬I«Ø°ê


   
§Úªºµ{¦¡½X©ñªº¦ì¸m¦p¤U¹Ï¡A¤£ºÞ§Aªº¸ô®|¦b­þ¡A¥u­n¦p¹Ï©ñ´N¥i¥H¤F

µM«á¶}±Ò¤u§@ï«á¡A¥u­nÂI¿ï¤u§@ªí´N·|°Ý§A¬O§_¶K¤W¹Ï¤ù¡A¹Ï¤ùªº¸ô®|·|¥h´M§ä"³oµ{¦¡©³¤U"ªº"¸ê®Æ§¨"¡A
¦]§A·íªì»¡ªº¡A·|©M¸ê®Æ§¨·|©M¤u§@ªí¦P¦W¡A¨Ò¦p¡GO13¤u§@ªí·|¥h§äO13ªº¸ê®Æ§¨¡A¹Ï¤ù¦WºÙ«h¬O¨Ì·ÓCÄ檺¦WºÙ¥h´M§ä¹Ï¤ù¡A

TOP

¦^´_ 4# ¬I«Ø°ê
1¿ù¤F
    ¦]¬°§A¤§«e¹Ï¤ù³o¼Ë©ñ
    C:\Users\Administrator\Desktop\±¼º£\O13\001.jpg

    ¨º§AExcel­n©ñ¦b
    C:\Users\Administrator\Desktop\±¼º£\§AªºExcelÀÉ®×
    °õ¦æ«e­n¥ý¿ï¨ì 'O13' ³o­Ó¤u§@ªí...
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¦^´_ 3# lpk187


¤p§Ì¸Õ¤F´X¤Ñ,ÁÙ¬O§Ë¤£¥X¨Ó
ÁÂÁ¤j­ô¼ö¤ß¦^ÂÐ,½Ð°Ý§Ú¬O­þ¸Ì°µ¿ù¾É­P»yªk¥¢±Ñ©O??







¤§«á·j¯Á¤@¨Ç¹Ï¤ùªº»yªk,§ä¨ìHsieh«e½ú¼gªº¦Û¤v¿ï¾ÜÀɮ׶K¤W
§Ú¦A§â¨º¤@¾ãÄæ°Å¤U¶K¤W,¤]¬O¤@ºØ¿ìªk
  1. Sub InputPictures()
  2. Dim fs(), A As Range
  3. If ActiveSheet.Shapes.Count > 0 Then
  4. ActiveSheet.Shapes.SelectAll
  5. Selection.Delete
  6. End If
  7. On Error GoTo 10
  8. fs = Application.GetOpenFilename("©Ò¦³¹Ï¤ù(*.jpg;*.png;*.tiff;*.bmp;*.gif),*.jpg;*.png;*.tiff;*.bmp;*.gif", , , , True)
  9. For i = 1 To UBound(fs)
  10. Set A = Cells(i, 1)
  11. A = fs(i)
  12. With ¤u§@ªí1.Shapes.AddPicture(fs(i), True, True, A.Offset(, 1).Left, A.Top, A.Offset(, 1).Width, A.Offset(, 1).Height)
  13. .Placement = xlMoveAndSize
  14. End With
  15. Next
  16. 10
  17. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# ¬I«Ø°ê


   §A¤W¦¸³o½g¤W¡A§Úªº½d¨Ò´N¦³¤F°Ú¡I
http://forum.twbts.com/viewthread.php?tid=14275&rpid=78737&ordertype=0&page=1#pid78737
  1. Private Sub Workbook_SheetActivate(ByVal Sh As Object)
  2. If MsgBox("¬O§_¶K¹Ï", 4) = vbNo Then Exit Sub
  3. For Each shap In Sheets(Sh.Name).Shapes
  4.     shap.Delete
  5. Next
  6. For Each Rng In Sheets(Sh.Name).Range("C3", Range("c3").End(xlDown))
  7.     Pat = ThisWorkbook.Path & "\" & Sh.Name & "\" & Rng & ".jpg"
  8.     Sheets(Sh.Name).Shapes.AddPicture Pat, True, True, Rng.Left, Rng.Top, Rng.Width, Rng.Height
  9. Next
  10. End Sub
½Æ»s¥N½X

TOP

¤Wºô¬d¨ìShapes.AddPicture
¦ý¤£ª¾¹D¦p¦ó¨ú¥N

±q¤w¦s¦bªºÀɮפ¤«Ø¥ß¹Ï¤ù¡C¶Ç¦^¥Nªí·s¹Ï¤ùªº Shape ª«¥ó¡C
»yªk

ActiveSheet.AddPicture(Filename, LinkToFile, SaveWithDocument, Left, Top, Width, Height)

°Ñ¼Æ

¦WºÙ ¥²­n/¿ï¥Î ¸ê®ÆÃþ«¬ ´y­z
Filename ¥²­n String ­n«Ø¥ß OLE ª«¥óªº¨Ó·½ÀɮסC
LinkToFile ¥²­n MsoTriState ­n³sµ²ªºÀɮסC
SaveWithDocument ¥²­n MsoTriState ­n»P¤å¥ó¤@¦PÀx¦sªº¹Ï¤ù¡C
Left ¥²­n Single ¹Ï¤ùªº¥ª¤W¨¤¦ì¸m (¥HÂI¬°³æ¦ì)¡A»P¤å¥ó¥ª¤W¨¤¬Û¹ï¡C
Top ¥²­n Single ¹Ï¤ùªº¥ª¤W¨¤¦ì¸m (¥HÂI¬°³æ¦ì)¡A»P¤å¥ó³»ºÝ¬Û¹ï¡C
Width ¥²­n Single ¹Ï¤ùªº¼e«× (¥HÂI¬°³æ¦ì)¡C
Height ¥²­n Single ¹Ï¤ùªº°ª«× (¥HÂI¬°³æ¦ì)¡C

¶Ç¦^­È Shape

TOP

        ÀR«ä¦Û¦b : Ãø¦æ¯à¦æ¡AÃø±Ë¯à±Ë¡AÃø¬°¯à¬°¡A¤~¯àª@µØ¦Û§Úªº¤H®æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD