Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server DTS
|
SQL Server DTS Discussion specific to Data Transformation Service with SQL Server. General SQL Server discussions should use the general SQL Server forum. Readers of the book Professional SQL Server 2000 DTS with questions specific to that book should post in that book forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server DTS section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 4th, 2007, 04:52 AM
Friend of Wrox
 
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Default execute xl macro in DTS 2000 activex script task

Hi, i need help please.
I have a code where i want to execute a excel macro via DTS 2000 ActiveX script, it can open the file on my PC(c:\DealsExceptions.asc)but does not execute the macro, the macro is in my pc & not on the server as the server does not have excel installed. i get stucked where it has to call the macro (xl_app.run "C:\Documents and Settings\ismailc\ApplicationData\Microsoft\Excel\X LSTART\PERSONAL.XLS!Macro2"), can anyone help or have any other solutions with examples please as i'm quite new to this, the below code i got was off the net, it is a vb script that executes in dts activex.
Thanking you in anticipation.

'************************************************* *******************
' Visual Basic ActiveX Script
'************************************************* *******************
Function Main()

dim xl_app
dim xl_Spreadsheet

set xl_app = CREATEOBJECT("Excel.Application")

set xl_Spreadsheet = xl_app.Workbooks.Open ("c:\Deals Exceptions.asc")

xl_app.Visible = true

xl_app.run "C:\Documents and Settings\ismailc\Application Data\Microsoft\Excel\XLSTART\PERSONAL.XLS!Macro2"

xl_Spreadsheet.Save
xl_Spreadsheet.Close

xl_app.quit
set xl_app = Nothing

Main = DTSTaskExecResult_Success
End Function

 
Old December 14th, 2007, 10:14 AM
Registered User
 
Join Date: Dec 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Fairly simple one I think, managed to get it working for me.

Just change the statement:
xl_app.run "C:\Documents and Settings\ismailc\Application Data\Microsoft\Excel\XLSTART\PERSONAL.XLS!Macro2"

to:

xl_app.run "Macro2"

Not sure why you reference Deals Exception.asc and then a different Excel file, this may be the cause if the above doesn't quite get it!

Good luck!





Similar Threads
Thread Thread Starter Forum Replies Last Post
DTS and ActiveX VB Script gscott SQL Server DTS 6 May 16th, 2007 07:38 AM
Running DTS package through Execute SQL / pkg Task sthekk SQL Server DTS 1 April 23rd, 2007 11:18 AM
Execute Task from ActiveX Script Task PorcupineRabbit SQL Server DTS 1 January 10th, 2006 12:37 PM
DTS Problem with ActiveX Script testsubject SQL Server DTS 1 December 23rd, 2005 05:11 PM
DTS Transform Data Task VB Script problem jan.aitken SQL Server DTS 0 May 28th, 2004 08:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.