Khalil Lakhani
New Member
Hi,
I am trying to acheive results by sending a text file (sql.sql) to SQL server and fetch the data into excel (64Bit). Any help would be appreciated -
Thanks,
I am trying to acheive results by sending a text file (sql.sql) to SQL server and fetch the data into excel (64Bit). Any help would be appreciated -
Thanks,
Code:
' Dim sqlFile As String
'sqlFile = "C:\Users\klakhani\Documents\sql.txt"
'Dim sqlText As String
'sqlText = File.ReadAllText(sqlFile)
' With ActiveWorkbook.Connections("Eligible_Tape_Pool").OLEDBConnection
' .BackgroundQuery = True
'.CommandText = Array("select * from Finance.GL.Originations where dshawboard >= '6/17/2015' and dshawboard < '6/24/2015'")
' .CommandText = Array("& sqlText &")
' .CommandType = xlCmdSql
' .Connection = Array( _
'"OLEDB;Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=Sandbox_Accounting;Data Source=sqlprdrep" _
, _
'"orting;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=THXLAP8402B1ZQ;Use Encryption for Data=Fa" _
', "lse;Tag with column collation when possible=False")
'.RefreshOnFileOpen = False
'.SavePassword = False
'.SourceConnectionFile = ""
'.SourceDataFile = ""
'.ServerCredentialsMethod = xlCredentialsMethodIntegrated
'.AlwaysUseConnectionFile = False
' End With
Last edited by a moderator: