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

[µo°Ý] ¶}¨ä¥LÀÉ®É(¨Ï¨äWorkbook_Open¥¨¶° ¥¢®Ä)¶È¯à°ßŪ

[µo°Ý] ¶}¨ä¥LÀÉ®É(¨Ï¨äWorkbook_Open¥¨¶° ¥¢®Ä)¶È¯à°ßŪ

½Ð±Ð¦U¦ì¤j¤j
Private Sub CommandButton2_Click()
    Sheets("sh1").Cells.Clear
    With CreateObject(ThisWorkbook.Path & "\" & "207¯Z.xls")
        .¨Ï "207¯Z.xls" ªºWorkbook_Open¥¨¶°  ¥¢®Ä
         .Sheets("sh1").Cells.Copy Sheets("sh1").Cells(1, 1)
         .Close True
    End With
    Application.Visible = False
End Sub
¦]¬°"  207¯Z.xls"  ¥»¨­§t¦³¥¨¶°   Private Sub Workbook_Open()
À³¦p¦ó  ¨Ï "207¯Z.xls" ªº¥¨¶°  ¥¢®Ä ?

ÁÂÁ«ü¾É

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-4-6 08:31 ½s¿è

¦^´_ 1# yangjie
  1. Application.EnableEvents = False
½Æ»s¥N½X
¤u§@ªíµøµ¡¤W¶}±ÒÂÂÀɮ׮ɫö¦í Shift Áä,¥ç¥i
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE
§¹¥þ¸Ñ¨M  ÁÂÁÂGBKEEª©¤j
¦A½Ð±Ð ­ì©l²Ä¤@ ­Ó.xlsÀɶ}±Ò®É   Sub Workbook_Open() À³¥[¤J???
              ¨Ï¨ä¥H°ßŪ¤è¦¡¶}±Ò¡I(¦ý¥¨¶°¤´¯à¨Ï¥Î ¦]¬°¶È¥Î©ó¬d¸ß)
Private Sub Workbook_Open()
    'Call MakeMenu
    °ßŪ???
    Application.Visible = False
    Call myForm1
End Sub

TOP

¦^´_ 3# yangjie
  1. Sub Ex()
  2.     Dim WB As Workbook, V As Object
  3.     Application.EnableEvents = False
  4.     Set WB = Workbooks.Open(Filename:=ThisWorkbook.Path & "\" & "207¯Z.xls", ReadOnly:=True)
  5.     With WB
  6.             'VBProject ª«¥ó¡A¸Óª«¥ó¥Nªí«ü©w¬¡­¶Ã¯¤¤ªº Visual Basic ±M®×¡C°ßŪ¡C
  7.         For Each V In .VBProject.VBComponents
  8.             'VBComponents ÄÝ©Ê ¶Ç¦^¥]§t¦b¤@­Ó±M®×¤¤ªº¤¸¥óªº¶°¦Xª«¥ó¡C
  9.           V.CodeModule.DeleteLines 1, V.CodeModule.CountOfLines
  10.             '§R°£ µ{¦¡½X
  11.         Next
  12.    End With
  13.        Application.EnableEvents = True
  14. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¦³Ä@©ñ¦b¤ß¸Ì¡A¨S¦³¨­Åé¤O¦æ¡A¥¿¦p¯Ñ¥Ð¤£¼½ºØ¡A¬Ò¬OªÅ¹L¦]½t¡C
ªð¦^¦Cªí ¤W¤@¥DÃD