Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2002

    Unanswered: How To Execute An Excel File Within DTS?

    Hello All.

    I need to execute an excel file (built with macro) whenever a date change is detected between 2 fields in my sql table.

    if @Date1<>@Date2
    DECLARE @command varchar(1000)
    SET @command='d:\Refresh_ABC.bat'
    exec xp_cmdshell @command

    In my Refresh_ABC.bat, I have the following line
    Start Excel.exe "D:\ABC.xls"

    When I tested the above script (from Declare... to @command) in query analyzer, nothing seems to happen. It shows The command(s) completed successfully. But my excel file was not refreshed at all. When I ran the batch file Refresh_ABC.bat on it's own, ABC.xls was refreshed so the batch file is working.

    Next test, I placed the line Start Excel.exe "D:\ABC.xls" on SET @command = ......... line. Same problem, nothing happened.

    Any idea what went wrong. Please advise. Thank you.

    Best regards
    Teck Boon

  2. #2
    Join Date
    Jun 2003

    Thumbs up Re

    Why dont use AciveX Script ,which can call Excel macro. Check this site for furthur information,

Posting Permissions

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