Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 26th, 2005, 12:35 PM
csamuels csamuels is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 175 csamuels User rank is Lance Corporal (50 - 100 Reputation Level)csamuels User rank is Lance Corporal (50 - 100 Reputation Level)csamuels User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Day 8 h 5 sec
Reputation Power: 4
vbs, odbc, excel, spreadsheet is full

im trying to add records to an excel file using a vbscript. I'm connecting to the excel file through an ADODB connection.

I use this code to connect
PHP Code:
function OpenConnection
  
'Set Up Connection Object'
  
Set ExcelConnect CreateObject("ADODB.Connection")
  
'Open Connection'
  
ExcelConnect.Open "Driver={Microsoft Excel Driver (*.xls)};" _
             
"DriverId=790;" _
             
"Dbq=" RouteName ";" _
             
"DefaultDir=" RoutePath ";" _
             
"ReadOnly=0;"
  'Check Connection'
  
If (Err.Number<>0Then
   MsgBox 
"Error Connecting To the Driver""Connection Error"
   
MsgBox err.desc"Description"
   
msgbox "end"
   
OpenConnection ' Return Connection to DB unsuccessful'
   
exit function
  
End IF
  
OpenConnection ' Return Connection to DB successful'
end function ' End OpenConnection' 


I get an error on the following code.

PHP Code:
 sub AddUWs
  
for i=0 to ubound(clob'Add Commerical UWs'
    
strquery "INSERT INTO MYTABLE (AGENT, ENDT) VALUES ('" AgentCode clob(i) & "','" CUW "')"
    
ExcelConnect.execute(strQuery'Run Query'
  
Next
  
for i=0 to ubound(plob'Add Personal UWs'
    
strquery "INSERT INTO MYTABLE (AGENT, ENDT) VALUES ('" AgentCode plob(i) & "','" PUW "')"
    
ExcelConnect.execute(strQuery'Run Query'
  
Next
end sub 
'End Add UWs' 



When i execute my script, i get the following error.


attached is a copy of the full script and excel file in a zip file.
Attached Files
File Type: zip vbs.zip (47.7 KB, 41 views)

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > vbs, odbc, excel, spreadsheet is full


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT