sqlinsert-statement

SQL Insert Statement (Databases)


I have a really basic SQL insert query which is holding up a larger automation RPA project I am working on.

I have populated two variables vRegistration & vStatus with values I would like to insert these values into Sheet1 - Columns 1 & 2 of a excel workbook (connected as a database)

The current statement I am using

 INSERT INTO [Sheet1$]
 VALUES ($vRegistration$ , $vStatus$)

Any help with the Insert Statement would be much appreciated.


Solution

  • Look at this link : https://sites.google.com/site/beyondexcel/project-updates/sqlinsertintoexcel

    You could replace this line with your insert statement, like this :

    oCn.Execute "Insert Into [Sheet1$] (ID,Name,Amt) Values(1,@YourVar1,@YourVar2)"