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

[µo°Ý] ¦p¦ó¿z¿ï¹Ï¤ù,¨Ã´¡¤J«ü©wªºÄæ¦ì

¥»©«³Ì«á¥Ñ Hsieh ©ó 2011-2-23 08:23 ½s¿è

¦^´_ 20# jackyliu

¤â°Ê§R°£µ{¦¡½X¥t¦s·sÀÉ´N¦n°Õ
­n¦Û°Ê¥t¦s®É§R°£µ{¦¡½X¡A¥i§Q¥ÎBEFORE_SAVE¨Æ¥ó§¹¦¨(¦pªþ¥ó)
insert_pictures.rar (1.74 MB)
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ jackyliu ©ó 2011-3-3 08:03 ½s¿è

ª©¤j  §ÚÅv­­ÁÙ¤Ó¤p, ©Ò¥H±zªºrar ªþ¥óÀÉ , µLªk¤U¸ü....
¥i§_©ú¥Ü~ ~

TOP

¦^´_ 22# jackyliu

thisworkbook¼Ò²Õ
  1. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
  2. If SaveAsUI = True And Cancel = False Then
  3. Dim vbc As Object
  4. With ThisWorkbook.VBProject
  5. For Each vbc In .VBComponents
  6.   Select Case vbc.Type
  7.   Case vbext_rk_Project, vbext_wt_Browser, vbext_ct_MSForm 'µù
  8.     .VBComponents.Remove .Item(vbc.Name)

  9.   Case Else
  10.     .VBComponents(vbc.Name).CodeModule.DeleteLines 1, _
  11.     .VBComponents(vbc.Name).CodeModule.CountOfLines

  12.   End Select
  13. Next
  14. End With
  15. End If
  16. End Sub


  17. Private Sub Workbook_Open()
  18. Set d = CreateObject("Scripting.Dictionary")
  19. fd = ThisWorkbook.Path & "\" '¹ÏÀɥؿý
  20. fs = Dir(fd & "*.jpg")
  21. Do Until fs = ""
  22. If InStr(fs, "-") = 0 Then '¥u¦³¼Æ­È
  23.    d(fs) = "H" & Val(fs) + 2 '¦]¬°¦b²Ä¦C©Ò¥H¥[2
  24.    ElseIf Len(fs) - Len(Replace(fs, "-", "")) = 1 Then '¥u¦³1­Ó¤À¹j²Å¸¹
  25.    '²Ä2½X¬°C´N¬OIÄæ¡A§_«h´N¦bJÄæ
  26.    V = Split(fs, "-")(1)
  27.      If Split(fs, "-")(1) Like "C*" Then d(fs) = "I" & Val(fs) + 2 Else d(fs) = "J" & Val(fs) + 2
  28.    Else
  29.    '²Ä3½X¬O1´N¦bKÄæ¡A2´N¦bLÄæ¡A¨ä¾l¦bMÄæ
  30.    ar = Split(fs, "-")
  31.    p = IIf(ar(1) = "C", Asc("K"), Asc("L")) '²Ä2½X¬OC´N¶Ç¦^"K"ªº¦r¤¸½X¡A²Ä2½X¬OT´N¶Ç¦^"L"ªº¦r¤¸½Xµ¹ÅܼÆp
  32.    k = Chr(Val(ar(2)) * 2 + p) '¦r¦êÅܼÆkªº­È¬O²Ä3½X+p¹ïÀ³¨ìªº¦r¦ê(´N¬OÄæ¦ì)
  33.    d(fs) = k & Val(fs) + 2
  34. End If
  35. fs = Dir
  36. Loop
  37. With Sheets("Sheet1")
  38. .Pictures.Delete '²M°£©Ò¦³¹Ï¤ù
  39. Application.ScreenUpdating = False
  40. For Each ky In d.keys
  41.    Set A = .Range(d(ky)) '¹Ï¤ù´¡¤Jªº¦ì¸m
  42.       With .Pictures.Insert(fd & ky) '´¡¤J¹ÏÀÉ
  43.          .ShapeRange.LockAspectRatio = msoFalse '¸Ñ°£ªø¼e¤ñ¨Ò
  44.          .Top = A.Top
  45.          .Left = A.Left
  46.          .Height = A.Height
  47.          .Width = A.Width
  48.        End With
  49. Next
  50. End With
  51. Application.ScreenUpdating = True
  52. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

±N¤W­± µ{¦¡code ½Æ»s¨ì Modul1, ±µµÛ­n¥h°õ¦æ¥¨¶°...
¥h¨S¦³ ¥¨¶°¦WºÙ­C ...  

¥¿±`¤§«e ¥¨¶°¦WºÙ¬O :Ex() , Sub auto_open()

²{¦bÅܦ¨ ¤£·| Run ¤F­C....

TOP

¦^´_ 24# jackyliu

¦bThisworkBook¼Ò²Õ¤º¡Aª½±µ¶K¤Jµ{¦¡½X
¶}±ÒÀɮ׮ɴN·|¦Û°Ê¸ü¤J¹Ï¤ù
¥t¦s·sÀÉ´N·|¦Û°Ê§R°£µ{¦¡½X¥t¦s
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ jackyliu ©ó 2011-2-23 21:24 ½s¿è

¥t¦s·sÀÉ  ·|¦³¿ù»~°T®§­C ....
¦Ó¥B  ·s«Ø¥ßªºÀɮפº ThisWorkbook ªºµ{¦¡code ¨Ã¨S¦³²M°£,
À³¸Ó ¬O»¡ " µ{¦¡code ©M¹Ï¤ù "  ¤@°_ ¥t¦s·sÀÉ­C

1004.jpg (11.45 KB)

1004.jpg

TOP

¦^´_ 26# jackyliu


    ¤u¨ã/¥¨¶°/¦w¥þ©Ê
¤Ä¿ï«H¥ô¦s¨úVisual Basic±M®×
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

«z....  ¤ÓÀy®`¤F
³o°}¤l ¨¯­W±z¤F ~

TOP

ªO¤j   ³o´X¤Ñ§Ú¥t¥~°µ¤@­Ó¼´¨ú¸ê®Æ®w¸ê®Æ VBA ,¸ê®Æ¼´¨ú§¹,¦Û°Ê¥t¦s·sÀÉ ¨Ã¥B§R°£µ{¦¡½X;
ª½±µ ½Æ»s ªO¤j¤WÀYªº Code °µ¦Û°Ê¥t¦s·sÀÉ ¨Ã¥B§R°£µ{¦¡½X,¥i¬O ²£¥Xªº·sÀɸ̳£·|µ{¦¡Code.
¥i§_«ü±Ð¤@¤U,­þ¸Ì¥X°ÝÃD¤F....

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI = True And Cancel = False Then
Dim vbc As Object
With ThisWorkbook.VBProject
For Each vbc In .VBComponents
  Select Case vbc.Type
  Case vbext_rk_Project, vbext_wt_Browser, vbext_ct_MSForm 'µù
    .VBComponents.Remove .Item(vbc.Name)
  Case Else
    .VBComponents(vbc.Name).CodeModule.DeleteLines 1, _
    .VBComponents(vbc.Name).CodeModule.CountOfLines
  End Select
Next
End With
End If
End Sub

TOP

¦^´_ 29# jackyliu

¸Õ¸Õ¬Ý
  1. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
  2. If SaveAsUI = True And Cancel = False Then
  3. Dim vbc As Object
  4. With ThisWorkbook.VBProject
  5. For Each vbc In .VBComponents
  6.   If vbc.Type = 1 Then
  7.   .VBComponents.Remove .VBComponents(vbc.Name)
  8.   Else
  9.     .VBComponents(vbc.Name).CodeModule.DeleteLines 1, _
  10.     .VBComponents(vbc.Name).CodeModule.CountOfLines
  11.   End If
  12. Next
  13. End With
  14. End If
  15. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ÀR§¤±`®¦¤v¹L¡B¶¢½Í²ö½×¤H«D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD