Running code from VBA to VBScript back to VBA

Viewed 5418

I'm trying to figure out a way to call a VBScript function using in Excel, and then pass a value back to . See below

VBA within Excel

    Sub RunTest()
    Dim objString as String

    'Begin Pseudocode
    objString = Call VBScript Function Test()
    'End Pseudocode

    MsgBox objString `from VBS
    End Sub

VBScript

    Function Test
    Test = "Hello World"
    End Function

I know this may seem strange because I could just write the function in VBA, but we had an office patch pushed out and it completely killed the functionality of one of my macros for some reason. Strange thing is, I can run the exact same code within any other office program, just not excel. As a work around, I moved the function that crashes excel to word and I pull it using application.run, but I prefer to not have to do that, as opening a the word application to run my macro slows my process way down.

Any help is appreciated, thank You

2 Answers
Related