Private Sub PrNotes_Click()
Dim fso As Object
Dim strPath As String
Set fso = CreateObject("Scripting.FileSystemObject")
Dim oFile As Object
strPath = TextBox1.Value & " Order Notes.txt"
Set oFile = fso.CreateTextFile(strPath)
oFile.writeline "Name : " & TextBox1.Value
oFile.writeline "Contact : " & TextBox2.Value
oFile.writeline "Email : " & TextBox3.Value
oFile.Close
Set fso = Nothing
Set oFile = Nothing
MsgBox ("Notes Generated Successfully in Documents Folder")
'Now this output should be on notepad instead of documents folder
End Sub
答案 0 :(得分:0)
替换
MsgBox ("Notes Generated Successfully in Documents Folder")
'Now this output should be on notepad instead of documents folder
与
Shell "notepad.exe /W """ & strPath & """", vbNormalFocus
警告:您必须知道strPath
处文件的编码,才能在/A
(即ASCII)和/W
之间进行选择,即Unicode。
另请参阅Notepad.exe command line options 和Shell at Office Support