问题
Sub Password()
'Loop through all files in a folder
Dim fileName As Variant
fileName = Dir("C:\State_K-1_Info\Password\*.pdf")
Do While fileName <> ""
CreateObject("Shell.Application").Open ("C:\State_K-1_Info\Password\001.pdf")
Application.Wait Now + 0.00005
'Insert the actions to be performed on each file
'This example will print the file name to the immediate window
Application.SendKeys "{Tab}", True
Application.SendKeys "^(s)", True
Application.SendKeys "%{F4}", True
'Set the fileName to the next file
fileName = Dir
Loop
End Sub
Unfortunately this just continually opens and closes the first file in the folder which is referenced in my create object line
来源:https://stackoverflow.com/questions/60046336/loop-through-open-perform-sendkeys-on-pdf-files-in-one-folder