Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: update excel cells
file = "D:\TEMP\FICH.XLS" ; change to suit your environment cConn = "Provider=MicroSoft.Jet.OLEDB.4.0; Data Source=%file%;Extended Properties=Excel 8.0" DB = ObjectOpen("ADODB.Connection") DB.Open(cConn) cSql = "UPDATE [SH1$] SET COMENT='HELLO', WHERE CODE='0005';" RS = DB.Execute(cSQL) DB.Close() ObjectClose(DB) Exit
I am able to treat the Excel Sheet as a Recordset Object. This is very simple, for data retrieval only, but the syntax of using [TabName$] is what is required.
adOpenDynamic = 2 adOpenKeySet = 1 adLockOptimistic = 3 adLockBatchOptimistic = 4 adCmdTable = 2 adCmdTableDirect = 512 adCmdText = 1 file = "E:\WBDEMO\RAO.XLS" ; change to suit your environment cConn = "Provider=MicroSoft.Jet.OLEDB.4.0; Data Source=%file%;Extended Properties=Excel 8.0" DB = ObjectOpen("ADODB.Connection") RS = ObjectOpen("ADODB.Recordset") DB.Open(cConn) RS.Open("RAO$",DB,adOpenKeySet,adLockOptimistic,adCmdTableDirect) x = 0 RS.MoveFirst() While ! RS.eof() fld = RS.Fields("BRAO") fld1 = RS.Fields("OCN") If StrSub( fld.Value,1,1) == "B" fld1.Value = 9999 x = x+1 Endif RS.MoveNext() Endwhile DB.Close() ObjectClose(DB) ObjectClose(RS) message("Number of OCN Values Changed",x) Exit
Article ID: W15261
File Created: 2002:09:05:13:50:52
Last Updated: 2002:09:05:13:50:52