LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default Updating a SQL stored procedure within EXCEL

I'm returning data from a SQL stored procedure that has 2 inputs Date1 and
Date2 using the following VB code.

With ActiveSheet.QueryTables.Add(ConnectionString, Range("A1"))
.CommandText = "EXEC sp_date_range_to_oee_values Date1, Date2
.Name = "Query from Plater_SQL"
.FieldNames = True
.PreserveFormatting = True
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With

It works ok but when I run it a second or third time it creates another data
set and concatenates it to the right of the previous extraction. I'm
selecting the destination cells and deleting the contents each time before
running the extraction to prevent the concantenation.

It's not very elegant and I'd like to make it better. Any thoughts.

Jefff
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run a Stored Procedure from Excel Jez Excel Programming 12 October 31st 08 04:32 PM
Return a stored procedure value to Excel nurkus[_2_] Excel Programming 1 September 6th 06 07:52 AM
execute stored procedure from excel maxzsim Excel Worksheet Functions 3 May 11th 05 04:58 PM
Getting stored procedure result to excel mkarja[_2_] Excel Programming 9 March 9th 05 12:56 PM
Run a stored procedure in Excel 2K ArthurB Excel Programming 0 February 26th 04 04:46 PM


All times are GMT +1. The time now is 06:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"