R
Rick S.
I have nearly identical code for Excel that functions properly, use some of
this in Word and it behaves differently.
Why? It's VBA!?
'==========Ecel
sNewItem = InputBox(prompt:="Enter Entire Path for Folder Location!")
On Error Resume Next
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set Folder = oFSO.GetFolder(sNewItem) 'folder location
For Each file In Folder.Files 'iterate thru all files in folder that
have "xls" suffix
sFileName = file
If Right(sFileName, 3) = "xls" Then 'check for "xls" suffix
Workbooks.Open FileName:=file.Path, Password:="xxxxx",
WriteResPassword:="xxxxx" 'pass workbook.open password
'========End Excel
'========Word
On Error Resume Next
sNewItem = InputBox(prompt:="Enter Entire Path for Documents you want
printed!") 'using User text instead of fixed text
Application.DisplayAlerts = False
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set Folder = oFSO.GetFolder(sNewItem) 'folder location
For Each file In Folder.Files 'iterate thru all files in folder that
have "doc" suffix
sFileName = file
If Right(sFileName, 3) = "doc" Then 'check for "doc" suffix
'open files progmatically
Documents.Open FileName:=file.Path
'========End Word
In Word, the program opens a FileDialog box???
--
Regards
Rick
XP Pro
Office 2007
this in Word and it behaves differently.
Why? It's VBA!?
'==========Ecel
sNewItem = InputBox(prompt:="Enter Entire Path for Folder Location!")
On Error Resume Next
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set Folder = oFSO.GetFolder(sNewItem) 'folder location
For Each file In Folder.Files 'iterate thru all files in folder that
have "xls" suffix
sFileName = file
If Right(sFileName, 3) = "xls" Then 'check for "xls" suffix
Workbooks.Open FileName:=file.Path, Password:="xxxxx",
WriteResPassword:="xxxxx" 'pass workbook.open password
'========End Excel
'========Word
On Error Resume Next
sNewItem = InputBox(prompt:="Enter Entire Path for Documents you want
printed!") 'using User text instead of fixed text
Application.DisplayAlerts = False
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set Folder = oFSO.GetFolder(sNewItem) 'folder location
For Each file In Folder.Files 'iterate thru all files in folder that
have "doc" suffix
sFileName = file
If Right(sFileName, 3) = "doc" Then 'check for "doc" suffix
'open files progmatically
Documents.Open FileName:=file.Path
'========End Word
In Word, the program opens a FileDialog box???
--
Regards
Rick
XP Pro
Office 2007