Last active
March 10, 2019 12:14
-
-
Save ezhov-da/37c8e034f6feb098577ad85e2c084d2f to your computer and use it in GitHub Desktop.
vba внесение данных с листа
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub load() | |
Dim ADO | |
Dim connectString As String | |
Dim zapros As String | |
Set ADO = CreateObject("ADODB.Connection") | |
connectString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=11111;Data Source=1111" | |
ADO.ConnectionTimeout = 0 | |
ADO.CommandTimeout = 0 | |
ADO.Open connectString | |
zapros = "delete from dbo.T_E_test_MX" | |
ADO.execute zapros | |
ActiveWorkbook.Sheets("МХ").Activate | |
Dim i | |
i = 2 | |
Do While Cells(i, 1) <> "" | |
zapros = "insert into dbo.T_E_test_MX(RC, typee, MXDZ) values('" & "" & "', '" & "" & "', " & "" & ") " | |
Debug.Print zapros | |
ADO.execute zapros | |
i = i + 1 | |
Loop | |
Debug.Print "FINISH" | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment