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,533
  • 9
  • 50
  • 84

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,722
  • 1
  • 24
  • 37