View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Patrick[_2_] Dave Patrick[_2_] is offline
external usenet poster
 
Posts: 25
Default Web Services using vba

You should be able to use ADO

Dim strSQL1 As String
strConnect1 = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=MyDatabase;Data Source=MyServer"
Dim cnn1 As ADODB.Connection
Set cnn1 = New ADODB.Connection
cnn1.Open strConnect1
Dim rs1 As ADODB.Recordset
Set rs1 = New ADODB.Recordset

strSQL1 = "SELECT lastname, firstname FROM tbl_names "

rs1.Open strSQL1, cnn1, adOpenForwardOnly, adLockReadOnly
Do While rs1.EOF = False
do something here

rs1.MoveNext
Loop
rs1.Close
cnn1.Close

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"djb" wrote:
| Thanks for the reply. I used to be able to connect directly to a SQL
Server
| database and bring the data automatically into Excel but now I have to go
| through a terminal server to access the data so I was hoping to create web
| services to the data on the SQL Server and consume them in Excel.
|
| "Fredrik Wahlgren" wrote:
|
|
| "djb" wrote in message
| ...
| Is it possible to consume web services in Excel using vba or do you
need
| to
| use .NET?
| --
| djb
|
| Maybe. I wouldn't recommend it. I think you would need VB6 or .Net code
that
| in turn calls Excel. Microsoft has recommended against using Excel as a
| server application. Can you please tell more about what you want to do?
|
| /Fredrik
|
|
|