columbo1977
Programmer
Hey All
I am having a problem, the code I have here was working last night only it wasnt opening the Excel documents as they are passworded. Now it isnt saying "Cannot use paranthisis when using a sub"??
can anyone help me get this to loop through the folder and open passworded excel documents and print them.
the code I was using for individual files was
Thanks for looking
I am having a problem, the code I have here was working last night only it wasnt opening the Excel documents as they are passworded. Now it isnt saying "Cannot use paranthisis when using a sub"??
can anyone help me get this to loop through the folder and open passworded excel documents and print them.
Code:
strDirectory = "File Path"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(strDirectory)
Set colItems = objFolder.Items
For Each objItem in colItems
objItem.InvokeVerbEx("Print")
Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objMainFolder = objFSO.GetFolder(strDirectory)
Set colSubfolders = objMainFolder.Subfolders
For Each objSubfolder in colSubfolders
strFolder = objSubfolder.Path
GetFiles strFolder
Next
sub GetFiles(byval strDirectory)
Set objWeeFolder = objShell.Namespace(strDirectory)
Set colWeeItems = objWeeFolder.Items
For Each objWeeItem in colWeeItems
objWeeItem.InvokeVerbEx("Print")
Next
end sub
the code I was using for individual files was
Code:
Dim AppExcel
Set AppExcel = CreateObject("Excel.application")
AppExcel.Workbooks.Open"File path and name.xls",,,,"password"
AppExcel.Visible = True
appExcel.ActiveWindow.SelectedSheets.PrintOut
Appexcel.Quit
Set appExcel = Nothing
Thanks for looking