我有一些每晚刷新的Excel文件
我现在想用密码保护它们,以便修改其中的任何数据,但是当脚本打开文件时,它会提示您输入密码,
如何通过脚本传递密码?
这是我用的(尝试过的)
Set fs = CreateObject("Scripting.FileSystemObject")
Set rootFolder = fs.GetFolder(fs.GetParentFolderName(wscript.ScriptFullName))
Set oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
oExcel.DisplayAlerts = False
oExcel.AskToUpdateLinks = False
oExcel.AlertBeforeOverwriting = False
For Each file in rootFolder.Files
If inStr(file.type, "Script") = 0 Then
Set oWorkbook = oExcel.Workbooks.Open(file.path)
Dim WSH
Set WSH = CreateObject("WScript.Shell")
wsh.sleep(25000)
Wsh.SendKeys "?"
Wsh.SendKeys "{ENTER}"
oWorkbook.RefreshAll
oWorkbook.Save
oWorkbook.Close
Set oWorkbook = Nothing
End If
Next
oExcel.Quit
set oExcel = nothing
Run Code Online (Sandbox Code Playgroud)
有什么帮助吗?我真的不使用vbs(根本)
编辑,此代码在打开文件时刷新所有文件,然后保存然后关闭,我只是不知道如何获取它以输入密码才能在完全编辑模式下打开它
Set fs = CreateObject("Scripting.FileSystemObject")
Set rootFolder = fs.GetFolder(fs.GetParentFolderName(wscript.ScriptFullName))
Set …Run Code Online (Sandbox Code Playgroud) 我很确定答案是,一旦我授予写/更改访问权限,它将明确授予该人删除权限。
SELECT
b.User_Id
,(CONVERT(varchar, DATEADD(hh, - 7, b.callstartdt), 101))as 'Dt'
,(COUNT(distinct b.SeqNum ) + Count(distinct c.SeqNum) + count(distinct d.seqnum)) as 'TotalCalls'
,COUNT(distinct b.SeqNum )as 'ACD'
,COUNT(distinct c.SeqNum)as 'AOD'
,COUNT(distinct d.seqnum) as 'Manual'
,COUNT(distinct e.SeqNum)as 'Contacts'
,COUNT (distinct es.seqnum) as 'Success'
FROM
[detail_epro].[dbo].[ACDCallDetail]as b
LEFT JOIN
[detail_epro].[dbo].[AODCallDetail]as c on c.User_Id = b.User_Id
LEFT JOIN
[detail_epro].[dbo].[manualCallDetail]as d on d.User_Id = b.User_Id
LEFT JOIN
(SELECT
USER_ID, CallStartDt, SeqNum
FROM
[detail_epro].[dbo].[AgentDispoDetail]
WHERE
Disp_Id IN
(100000150, 100000126, 100000137, 100000093, 100000133,
100000123, 100000094, 100000161, 100000162, 100000085,
100000084, …Run Code Online (Sandbox Code Playgroud)