|
我有一段excel vba批量打印word文件的代码,想把这句代码Pages:="1"的常量设置成变量?请高手回答!
Sub Print1()
Dim mypath, myfile, wApp
With Application.FileDialog(msoFileDialogFolderPicker)
If .Show = False Then Exit Sub
mypath = .SelectedItems(1) & "\"
End With
myfile = Dir(mypath & "*.doc*")
On Error GoTo ERROR1
Do While myfile <> ""
Set wApp = CreateObject("word.application")
With wApp
.documents.Open mypath & myfile
.ActiveDocument.PrintOut Range:=wdPrintRangeOfPages, Pages:="1"
.NormalTemplate.Saved = True
.Quit
End With
Set wApp = Nothing
myfile = Dir
Loop
Exit Sub
ERROR1:
wApp.Application.Quit
End Sub
|
|