0

I search answers on this site , but they do not have complete info

I have a file c: ....test.xlsm it has a subroutine test ()

sub test () 
msgbox "hello stackoverflow"
end sub

I want to write a vbscript that would

1) open c: ....test.xlsm

2) run test () subroutine

3) close c: ....test.xlsm

How can I do this ?

Community
  • 1
  • 1
CHEBURASHKA
  • 1,623
  • 11
  • 53
  • 85

1 Answers1

1

Assuming it is in a module, you would call it like so

dim eApp
set eApp = GetObject("C:\wb.xlsm")
eApp.Application.Run "wb.xlsm!test"
set eApp = nothing
Sorceri
  • 7,870
  • 1
  • 29
  • 38