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

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

¦^´_ 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

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

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

TOP

¥»©«³Ì«á¥Ñ 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

©Ò¥H µ{¦¡¥iŪ¨ì¹Ï¤ù¦WºÙ200.jpg ©Î¬O200-C-0.jpg ,©Ò¥H¬O¨S¦³¤ñ¼Æ­­¨î...

¥t¥~..¹Ï¤ù´¡¤J«á,¥t¦s·sÀÉ®É,·sÀx¦sªºÀÉ®×,·|Áp±aVBA  µ{¦¡Code ±a¦Ü ·sÀÉ®×­C;
¥i§_¥t¦sÀÉ®×®É ,¤£­n¤]±NVBA  µ{¦¡Code ¦s¨ì·sÀÉ®× ( ·sÀɮפ£­n¦³ VBA  µ{¦¡Code ) ­n¦p§@ ?

¤°»ò¤è¦¡³£¥i¥H ,³Â·Ð «ü±Ð¤@¤U !

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2011-2-21 22:26 ½s¿è

¥ÎOPEN¨Æ¥óµ{§ÇÅX°Ê§Y¥i¶}±ÒÀÉ®×´N¸ü¤J¹Ï¤ù
Sub Ex()
§ï¦¨Sub auto_open()
§â©Ò¦³µ{¦¡½X©ñ¦b¤@¯ë¼Ò²Õ


ÀɮצWºÙ¥u­n¬O®Ú¾Ú§Aªº´y­z±ø¥ó©R¦WÀ³¸Ó´N¨S¿ù
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

­C ... ·Pı¹ï¤F­C~
ªO¤j  ·P®¦

¤£ª¾¹D ¥i´¡¤J¨ì200.jpg ©Î¬O200-C-0.jpg µ{¦¡code ­þ¸Ì ¥i¥H¬Ý¥X¨Ó? ¦³­­¨î¶Ü?
­Y¬O­n¶}±Òexecl ´Nª½±µ±Ò°Ê¥¨¶° (¶}±Òexecl ¹Ï¤ù´N¦Û°Ê´¡¤J,­n¥[¤°»ò«ü¥O;Áٻݭn±Nµ{¦¡©ñ¦b¼Ò²Õ¸Ì¶Ü?)

TOP

¦^´_ 16# jackyliu
  1. Sub Ex()
  2. Set d = CreateObject("Scripting.Dictionary")
  3. fd = ThisWorkbook.Path & "\" '¹ÏÀɥؿý
  4. fs = Dir(fd & "*.jpg")
  5. Do Until fs = ""
  6. If InStr(fs, "-") = 0 Then '¥u¦³¼Æ­È
  7.    d(fs) = "H" & Val(fs) + 2 '¦]¬°¦b²Ä¦C©Ò¥H¥[2
  8.    ElseIf Len(fs) - Len(Replace(fs, "-", "")) = 1 Then '¥u¦³1­Ó¤À¹j²Å¸¹
  9.    '²Ä2½X¬°C´N¬OIÄæ¡A§_«h´N¦bJÄæ
  10.    V = Split(fs, "-")(1)
  11.      If Split(fs, "-")(1) Like "C*" Then d(fs) = "I" & Val(fs) + 2 Else d(fs) = "J" & Val(fs) + 2
  12.    Else
  13.    '²Ä3½X¬O1´N¦bKÄæ¡A2´N¦bLÄæ¡A¨ä¾l¦bMÄæ
  14.    ar = Split(fs, "-")
  15.    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
  16.    k = Chr(Val(ar(2)) * 2 + p) '¦r¦êÅܼÆkªº­È¬O²Ä3½X+p¹ïÀ³¨ìªº¦r¦ê(´N¬OÄæ¦ì)
  17.    d(fs) = k & Val(fs) + 2
  18. End If
  19. fs = Dir
  20. Loop
  21. With Sheets("Sheet1")
  22. .Pictures.Delete '²M°£©Ò¦³¹Ï¤ù
  23. Application.ScreenUpdating = False
  24. For Each ky In d.keys
  25.    Set A = .Range(d(ky)) '¹Ï¤ù´¡¤Jªº¦ì¸m
  26.       With .Pictures.Insert(fd & ky) '´¡¤J¹ÏÀÉ
  27.          .ShapeRange.LockAspectRatio = msoFalse '¸Ñ°£ªø¼e¤ñ¨Ò
  28.          .Top = A.Top
  29.          .Left = A.Left
  30.          .Height = A.Height
  31.          .Width = A.Width
  32.        End With
  33. Next
  34. End With
  35. Application.ScreenUpdating = True
  36. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ jackyliu ©ó 2011-2-19 22:13 ½s¿è

ª©¤j ¥Ø«e´ú¸Õ 11±i¹Ï¤ù ,À³¸Ó·|¤À§O®t¤J 11­Ó Àx¦s®æ (H Äæ~RÄæ)
µ²ªG µo²{ ¦³¨Ç¹Ï¤ù ­«Å|±¡¦æ,¤£ª¾­þ¸Ì¥X¿ù¤F?
½Ð±z À°¦£´ú¸Õ¤@¤U, ·PÁÂ~

¦pªþ¥ó!

pic.rar (728.4 KB)

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2011-2-19 11:33 ½s¿è

¦^´_ 14# jackyliu
  1. Sub Ex()
  2. Set d = CreateObject("Scripting.Dictionary")
  3. fd = ThisWorkbook.Path & "\" '¹ÏÀɥؿý
  4. fs = Dir(fd & "*.jpg")
  5. Do Until fs = ""
  6. If InStr(fs, "-") = 0 Then '¥u¦³¼Æ­È
  7.    d(fs) = "H" & Val(fs) + 2 '¦]¬°¦b²Ä¦C©Ò¥H¥[2
  8.    ElseIf Len(fs) - Len(Replace(fs, "-", "")) = 1 Then '¥u¦³1­Ó¤À¹j²Å¸¹
  9.    '²Ä2½X¬°C´N¬OIÄæ¡A§_«h´N¦bJÄæ
  10.      If Split(fs, "-")(1) = "C" Then d(fs) = "I" & Val(fs) + 2 Else d(fs) = "J" & Val(fs) + 2
  11.    Else
  12.    '²Ä3½X¬O1´N¦bKÄæ¡A2´N¦bLÄæ¡A¨ä¾l¦bMÄæ
  13.    ar = Split(fs, "-")
  14.    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
  15.    k = Chr(Val(ar(2)) + p) '¦r¦êÅܼÆkªº­È¬O²Ä3½X+p¹ïÀ³¨ìªº¦r¦ê(´N¬OÄæ¦ì)
  16.    d(fs) = k & Val(fs) + 2
  17. End If
  18. fs = Dir
  19. Loop
  20. With Sheets("Sheet1")
  21. .Pictures.Delete '²M°£©Ò¦³¹Ï¤ù
  22. Application.ScreenUpdating = False
  23. For Each ky In d.keys
  24.    Set A = .Range(d(ky)) '¹Ï¤ù´¡¤Jªº¦ì¸m
  25.       With .Pictures.Insert(fd & ky) '´¡¤J¹ÏÀÉ
  26.          .ShapeRange.LockAspectRatio = msoFalse '¸Ñ°£ªø¼e¤ñ¨Ò
  27.          .Top = A.Top
  28.          .Left = A.Left
  29.          .Height = A.Height
  30.          .Width = A.Width
  31.        End With
  32. Next
  33. End With
  34. Application.ScreenUpdating = True
  35. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ jackyliu ©ó 2011-2-19 06:37 ½s¿è

[attach]4793[/attach]¨Æ¥Ñ: ¦]ÀÉÀɦW¦³ 1-C-0, 1-C-1, 1-T-1 , 1-T-2 .....   ;»Ý¤À§O´¡¤J¦ÜKÄæ~RÄæ

§Ú·Q»¡§ï¦¨ ²Ä3½X½s½X¦¨0~7 ,¤À§O´¡¤J¦ÜKÄæ~RÄæ, ©Ò¥H©¹©³¤U³o¤@¦æ°Ê¤â,¤@ª½µLªk°õ¦æ,¤£ª¾¹D¬°¤°»ò¤£¦æ?
§ïªk -->IIf(Split(fs, "-")(8) = 0, "K",IIf(Split(fs, "-")(8) = 1, "L",IIf(Split(fs, "-")(8) = 2, "M",IIf(Split(fs, "-")(8) = 3, "N", "O"))
¤W­±¬O­þ¥X¿ù¤F,¥i§_À°¦£¤@¤U ! ÁÂÁ !


­ìµ{¦¡Code:
k = IIf(Split(fs, "-")(2) = 1, "K", IIf(Split(fs, "-")(2) = 2, "L", "M"))-->²Ä3½X¬O1´N¦bKÄæ¡A2´N¦bLÄæ¡A¨ä¾l¦bMÄæ

¹Ï¤ù»¡©ú¦pªþ¹Ï

1.jpg (17.62 KB)

1.jpg

1.jpg (18.42 KB)

µ²ªGªí¥Ü¹Ï

1.jpg

TOP

        ÀR«ä¦Û¦b : ¦³´¼¼z¤~¯à¤À¿ëµ½´c¨¸¥¿¡F¦³Á¾µê¤~¯à«Ø¥ß¬üº¡¤H¥Í¡C
ªð¦^¦Cªí ¤W¤@¥DÃD