PC Review


Reply
Thread Tools Rate Thread

How to automating Excel from an SQL Server Script?

 
 
=?Utf-8?B?QWw=?=
Guest
Posts: n/a
 
      24th Oct 2007
I have an Excel worksheet that is linked to an SQL stored procedure. I have
coded with VBA this worksheet to Open, Update the data from the SQL stored
procedure it is linked to, then copy this data to another worksheet, format
the columns and data, and close both worksheets.

The goal of this is to open, run, and close this Excel worksheet from
commands stored in an SQL script (view, stored procedure, function) that will
be called to run once a month.

Any ideas how to do this? Or is there a better way to do this? Should this
be posted somewhere else (where)?

Thanks ahead of time for your responses, and ideas!!
 
Reply With Quote
 
 
 
 
=?Utf-8?B?dXJrZWM=?=
Guest
Posts: n/a
 
      25th Oct 2007
"Al" wrote:

> I have an Excel worksheet that is linked to an SQL stored procedure. I have
> coded with VBA this worksheet to Open, Update the data from the SQL stored
> procedure it is linked to, then copy this data to another worksheet, format
> the columns and data, and close both worksheets.
>
> The goal of this is to open, run, and close this Excel worksheet from
> commands stored in an SQL script (view, stored procedure, function) that will
> be called to run once a month.
>
> Any ideas how to do this? Or is there a better way to do this? Should this
> be posted somewhere else (where)?
>
> Thanks ahead of time for your responses, and ideas!!



You can use sp_OACrate (and simmilar) SQL Server stored procedure to work
with Excel from SQL Server, but I think this is not the easiest way to work
with COM objects (look in SQL Server Books Online for sp_OA* samples and
you'll see what I mean). If you already have VBA code that works, maybe you
can use Scheduled Tasks to run it once a manth from Excel, and avoid using
SQL Server stored procedures at all. (maybe using Workbook.Open event?)

Hope this helps.

--
urkec
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automating Word from script Joel Allen Microsoft Outlook VBA Programming 8 1st Sep 2009 12:28 AM
Script to save Excel file to the server. raj41977 Microsoft Excel Misc 3 8th Dec 2005 02:48 PM
Automating Excel with Java Script =?Utf-8?B?SmltIEh1ZHNvbg==?= Microsoft Excel Programming 0 1st Dec 2003 02:26 PM
RE: Automating Excel on a Server Peter Huang [MSFT] Microsoft Excel Programming 0 26th Aug 2003 12:56 PM
automating a script to add win2k cleint to a domain Richard Microsoft Windows 2000 Networking 0 18th Jul 2003 03:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:37 PM.