VB提示“用户定义类型未定义”,怎么解决
展开全部
'用不同版本的办公软件可能有点不同
Private Sub Command1_Click()
Dim wdApp As New Word.Application '在这里提示用户定义类型未定义
Dim wdDoc As Word.Document
Dim strFileName As String
wdApp.Visible = False
strFileName = File1.Path + "\" + File1.FileName
Set wdDoc = wdApp.Documents.Open(strFileName)
wdDoc.SaveAs "c:\临时文件.RTF", 6
wdDoc.Close
wdApp.Quit
RichTextBox1.FileName = "c:\临时文件.RTF"
Kill "c:\临时文件.RTF"
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive '错误424 要求对象
End Sub
Private Sub Command1_Click()
Dim wdApp As New Word.Application '在这里提示用户定义类型未定义
Dim wdDoc As Word.Document
Dim strFileName As String
wdApp.Visible = False
strFileName = File1.Path + "\" + File1.FileName
Set wdDoc = wdApp.Documents.Open(strFileName)
wdDoc.SaveAs "c:\临时文件.RTF", 6
wdDoc.Close
wdApp.Quit
RichTextBox1.FileName = "c:\临时文件.RTF"
Kill "c:\临时文件.RTF"
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive '错误424 要求对象
End Sub
展开全部
注意这里选择“Microsoft Word X.0 Object Library”而不是Microsoft office X.0 Object Library
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
引用北极星点亮的回答:
'用不同版本的办公软件可能有点不同
Private Sub Command1_Click()
Dim wdApp As New Word.Application '在这里提示用户定义类型未定义
Dim wdDoc As Word.Document
Dim strFileName As String
wdApp.Visible = False
strFileName = File1.Path + "\" + File1.FileName
Set wdDoc = wdApp.Documents.Open(strFileName)
wdDoc.SaveAs "c:\临时文件.RTF", 6
wdDoc.Close
wdApp.Quit
RichTextBox1.FileName = "c:\临时文件.RTF"
Kill "c:\临时文件.RTF"
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive '错误424 要求对象
End Sub
'用不同版本的办公软件可能有点不同
Private Sub Command1_Click()
Dim wdApp As New Word.Application '在这里提示用户定义类型未定义
Dim wdDoc As Word.Document
Dim strFileName As String
wdApp.Visible = False
strFileName = File1.Path + "\" + File1.FileName
Set wdDoc = wdApp.Documents.Open(strFileName)
wdDoc.SaveAs "c:\临时文件.RTF", 6
wdDoc.Close
wdApp.Quit
RichTextBox1.FileName = "c:\临时文件.RTF"
Kill "c:\临时文件.RTF"
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive '错误424 要求对象
End Sub
展开全部
到底怎么解决的呢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询