- ©«¤l
- 95
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 118
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2015-11-10
- ³Ì«áµn¿ý
- 2020-5-25
|
[µ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¡AY³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 |
|