以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]文本框内容写入word (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=126711) |
-- 作者:天一生水 -- 发布时间:2018/10/26 22:06:00 -- [求助]文本框内容写入word 文本框写入记事本没事,写入word,提示选择文本编码。 应该怎样写如word? 谢谢! Dim ss As String = e.Form.Controls("TextBox1").text FileSys.WriteAllText("d:\\test.doc", ss, False, Encoding.Default) Dim proc1 As new process proc1.file = "d:\\test.doc" proc1.start |
-- 作者:有点蓝 -- 发布时间:2018/10/26 22:55:00 -- word不能使用FileSys.WriteAllText 要使用vba Dim app As New MSWord.Application try Dim doc = app.Documents.add Dim ss As String = e.Form.Controls("TextBox1").text doc.Content.InsertAfter(ss ) Doc.SaveAs ("d:\\test.doc") app.Visible = True catch ex As exception msgbox(ex.message) app.Quit finally End try |