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

[µo°Ý] ¨D§UÀ°ÀˬdVBA¨º¨à¦³°ÝÃD

[µo°Ý] ¨D§UÀ°ÀˬdVBA¨º¨à¦³°ÝÃD

¤U­±Workbook­ì¥»¦³3­ÓVBA¡A¦Û±q¥[¤J¤F²Ä4­ÓVBA«á¡A²Ä2­ÓVBAªº®ÄªG¶}©l¦³¤FÂI°ÝÃD(EXCEL2000ª©)¡A
¬O¬Æ»ò¦a¤èÅÞ¿è©Î±Æ¦C¦³°ÝÃD¶Ü?
¥i¬O¦pªG§â²Ä4­Ó®³±¼¡A´N¤S¥¿±`¡F
§Ú¥ý§âVBA¶K¤W¨Ó³o¡A³o¦U¦ì¤j¤jÀ°§Ú¬Ý¬Ý­þ¦³°ÝÃD¡A­Y³o¼ËµL§ä¥X°ÝÃD¡A§Ú¦A¥tªþÀɮפW¨Ó¡A¥ýÁÂÁ¦U¦ì¤F¡I


Private Sub Workbook_Open()

Call ÀË´ú¸ê®ÆÀÉ: If xMsg = "" Then GoTo 999 '²Ä1­ÓVBA

MsgBox xMsg & Chr(10) & Chr(10) & _
       "¼u¥Xµøµ¡Åã¥Ü¤å¦r" & Chr(10) & Chr(10) & _
       "¼u¥Xµøµ¡Åã¥Ü¤å¦r2"
      
Application.DisplayAlerts = False
If Workbooks.Count = 1 Then
   Application.Quit
Else
   ThisWorkbook.Close 0
End If
Application.DisplayAlerts = True
Exit Sub
999:
If Info2 <> "" Then MsgBox Info2


              Worksheets("sheet1").Protect Password:="123", userInterFaceonly:=True   '²Ä2­ÓVBA

              Worksheets("sheet1").EnableAutoFilter = True
              
              
Dim Str, GetValue   '²Ä3­ÓVBA
On Error Resume Next
Str = "'" & "C:\Users\Desktop\[TEST.xls]TEST'!R1C1" '¸ô®|ÀɦW¦Û¦æ­×§ï
GetValue = Application.ExecuteExcel4Macro(Str)
If Sheet4.[A1] <> GetValue Then MsgBox "WORD¡I", 48



Dim MyB As Workbook, xB As Workbook, xFile$ '²Ä4­ÓVBA
Set MyB = ThisWorkbook
xFile = "C:\Users\Desktop\TEST1.xls"  '¸ô®|ÀɦW¦Û¦æ­×§ï
Application.ScreenUpdating = False
Set xB = Workbooks.Open(xFile, ReadOnly:=True)

xB.Sheets("TEST1").Protect "123"
With MyB.Sheets("TEST2")
    .Unprotect "123"
    xB.Sheets("TEST3").[B1:BA500].Copy .[B1]
    .Protect "123"
End With



xB.Close 0


         End Sub

¦^´_ 2# luhpro


    ¸ÕµÛ¦bSet xB = Workbooks.Open(xFile, ReadOnly:=True) «e«á¥[¤W

Application.EnableEvents = False         bOpen = True
                                                              »P
Application.EnableEvents = True          bOpen = False

¦P¼Ë°ÝÃD¦ü¥G¤]¬O¦s¦b¡IQQ
¨SÃö«Y§Ú¦A§ä¬Ý¦³¨S¥¦ªk¦n¤F¡A¤]ÁÂÁÂuhpro´£¨Ñªº¤èªkÅý§Ú°Ñ¦Ò³á

TOP

¦^´_ 4# luhpro

½Ð°Ý¤@¤U¤j®v
Set xB = Workbooks.Open(xFile, ReadOnly:=True)
³o¬q¬O¬Æ»ò¥\¯à©O? ¦³¦s¦b¥²­n¶Ü?

TOP

        ÀR«ä¦Û¦b : ¯àµ½¥Î®É¶¡ªº¤H¡A¥²¯à´x´¤¦Û¤v§V¤Oªº¤è¦V¡C
ªð¦^¦Cªí ¤W¤@¥DÃD