暱稱: RCRG滾奶滾企
中學生
- 帖子
- 95
- 主題
- 24
- 精華
- 0
- 積分
- 118
- 點名
- 0
- 作業系統
- XP
- 軟體版本
- Office 2003
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2015-11-10
- 最後登錄
- 2020-5-25
|
下面Workbook原本有3個VBA,自從加入了第4個VBA後,第2個VBA的效果開始有了點問題(EXCEL2000版),
是甚麼地方邏輯或排列有問題嗎?
可是如果把第4個拿掉,就又正常;
我先把VBA貼上來這,這各位大大幫我看看哪有問題,若這樣無找出問題,我再另附檔案上來,先謝謝各位了!
Private Sub Workbook_Open()
Call 檢測資料檔: If xMsg = "" Then GoTo 999 '第1個VBA
MsgBox xMsg & Chr(10) & Chr(10) & _
"彈出視窗顯示文字" & Chr(10) & Chr(10) & _
"彈出視窗顯示文字2"
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" '路徑檔名自行修改
GetValue = Application.ExecuteExcel4Macro(Str)
If Sheet4.[A1] <> GetValue Then MsgBox "WORD!", 48
Dim MyB As Workbook, xB As Workbook, xFile$ '第4個VBA
Set MyB = ThisWorkbook
xFile = "C:\Users\Desktop\TEST1.xls" '路徑檔名自行修改
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 |
|