乱码怎么办?怎么解决?
我用VB编写了个系统,其中有个功能是:从Word文档中读取数据到Richtextbox中,可是读出的却是乱码,我的代码如下:
RichTextBox1.FileName = App.Path & "\c++试卷\ " & rim(rst.Fields(1)) & ".doc "
Open RichTextBox1.FileName For Input As #1
Do While Not EOF(1)
s1 = Input(1, #1)
RichTextBox1.Text = RichTextBox1.Text + s1
Loop
Close #1
请问如何解决啊,Vb高手们,怎么解决这个问题?我只想从word中读取数据,而不是读取txt格式的文本,怎么办?
本人在线等候,亟盼回复!
QQ:572221876
[解决办法]
'加载CommonDialog部件和word引用
Dim wordname As String
CommonDialog1.ShowOpen
wordname = CommonDialog1.FileName
Dim wapp As New Word.Application
Dim wdoc As Word.Document
Set wdoc = wapp.Documents.Open(FileName:=wordname)
Set wapp = Nothing