Skip to content

Update ExcelSaveAs.vbs to support open excel with password #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Excel Operations/Excel Save As/ExcelSaveAs.vbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ InputFile = Wscript.Arguments(0)
SheetName = Wscript.Arguments(1)
OutputFile = Wscript.Arguments(2)
Ext = Wscript.Arguments(3)
Dim password
If WScript.Arguments.Count > 4 then
password = Wscript.Arguments(4)
End If
Set objExcel = CreateObject("Excel.application")
objExcel.application.visible=false
objExcel.application.displayalerts=false
set objExcelBook = objExcel.Workbooks.Open(InputFile)
If Not isEmpty(password) then
set objExcelBook = objExcel.Workbooks.Open(InputFile,,,,password)
Else
set objExcelBook = objExcel.Workbooks.Open(InputFile)
End If
objExcel.Sheets(SheetName).Select
objExcelBook.SaveAs OutputFile, Ext
objExcel.Application.Quit
Expand Down
9 changes: 9 additions & 0 deletions Scripts/PreventScreenLockDaemon.vbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
' Prevent computer lock screen during automation process
' Need to [Open Program/File] Command,not [Run Script] Command

Set WshShell = WScript.CreateObject("WScript.Shell")
While True
WScript.Sleep 1000*60
WshShell.SendKeys "{NUMLOCK}"
WshShell.SendKeys "{NUMLOCK}"
Wend