Consulting

Results 1 to 3 of 3

Thread: Made VBS to Run Macro, but it doesen't

  1. #1

    Made VBS to Run Macro, but it doesen't

    This is what I placed in 1.vbs, please note that the Macro is within a Module


    Set objExcel = CreateObject("Excel.Application")
    objExcel.Application.Run "'C:\Users\John\Documents\Folder\1\1.xlsm'!MacroinModule"
    objExcel.DisplayAlerts = False
    Set objExcel = Nothing

    The .vbs runs, then I see at the Modified date that it updates to the time when the .vbs ran, but the macro doesen't work inside the .xlsm when the .vbs is running. The macro works just after opening Excel and pressing the "Run" Button

    Any idea why?

    Thanks
    John

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location
    Don't you need to open the workbook within that excel object, set an object to that, and run the macro within that object.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Thank you, it worked !

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •