word vba 怎么无法打印出来文件呢?麻烦老师帮忙看看!
Dim dy As WinForm.ComboBox = e.Form.Controls("打印机")
Dim t3 As WinForm.TextBox = e.Form.Controls("单元格行")
Dim t4 As WinForm.TextBox = e.Form.Controls("单元格列")
Dim t5 As WinForm.TextBox = e.Form.Controls("文件目录")
Dim t6 As WinForm.TextBox = e.Form.Controls("单元格新值")
Dim t7 As WinForm.TextBox = e.Form.Controls("运行状态")
Dim js As WinForm.Label = e.Form.Controls("计数")
Dim wj As WinForm.ComboBox = e.Form.Controls("文件后缀")
Dim abc As Integer= 0
Dim dt = t7.BaseControl
Dim App As New MSWord.Application
If dy.text=""then
MessageBox.Show("请选择打印机!")
Else
If t5.value="" Then
MessageBox.Show("请输入文件所在目录")
Else
For Each File As String In FileSys.GetFiles(t5.value)
Dim ifo As new FileInfo(File)
If ifo.Name.Contains("~$") Then
Else
If ifo.Extension.Contains(wj.text) Then
Dim doc As Object = app.Documents.Open(file)
app.ActiveWindow.Selection.WholeStory
doc.PrintOut(ActivePrinter:=dy.text)
abc=abc+1
App.Quit
js.Text= "已完成" & abc & "件/次!"
t7.Text= t7.Text & vbcrlf & "【" & ifo.Name & "】记录,已加入打印队列!"
t7.SelectionStart = t7.Text.Length
dt.ScrollToCaret
Application.DoEvents
End If
End If
Dim sc As WinForm.RadioButton = e.Form.Controls("打印后是否删除文件")
If sc.Checked=True
If FileSys.FileExists(File) Then '如果指定的文件存在
FileSys.DeleteFile(File,2,2) '则彻底删除之
End If
End If
Next
End If
End If