Private Sub Command1_Click()
Dim myDoc, WordApp As Object
Set WordApp = CreateObject("Word.Application")
Set myDoc = WordApp.Documents.Add()
myDoc.SaveAs "c:\新建 Microsoft Word 文档.doc"
End Sub
Private Sub Form_Load()
Dim myDoc, WordApp As Object
Dim filename As String
Set WordApp = CreateObject("Word.Application")
Set myDoc = WordApp.Documents.Add()
filename = App.Path & "\新建 Microsoft Word 文档.doc"
myDoc.SaveAs filename
End Sub
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Command1_Click()
Open "c:\新建文档.doc" For Output As #1
Print #1, "这是用VB新建的文档"
Close
ShellExecute Me.hwnd, "open", "c:\新建文档.doc", vbNullString, vbNullString, 5
End
End Sub