0

After run excel as administrator, I can't getobject(, "excell.application"). -> Error occurred.

Is there has another method which I can control Excel(run as administrator)?

Below is the code I wrote.

dim xl_ap, xl, wbs

set xl_ap = createobject("Excel.application")

set xl = getobject(, "excel.application")

for each wbs in xl.workbooks

 set wb = wbs

next

msgbox(wb.name)
Geert Bellekens
  • 12,788
  • 2
  • 23
  • 50
chi Moon
  • 11
  • 2
  • You use createobject or getobject(filename) or getobject(,RunningAppName). Not two of them. – user14797724 Jan 14 '21 at 03:31
  • 1
    You'll have to run you script as administrator as well to be able to use the Excel instance running as administrator. – Geert Bellekens Jan 14 '21 at 06:00
  • https://stackoverflow.com/questions/65642201/i-would-like-to-create-a-vbs-file-that-runs-the-xlsm-file-with-administrator-p?answertab=active#tab-top – Hackoo Jan 14 '21 at 15:14

0 Answers0