Retrieving data from Excel and store it into string variable

  • Thread starter Thread starter marsulein
  • Start date Start date
M

marsulein

Dim strTemp As String
Dim objExcel As Object
Dim cnnExcel As String

strTemp = objExcel.Fields("Resource").Value


I open the connection this way:

cnnExcel = "driver={Microsoft Excel Driver (*.xls)};" & _
"dbq=<*some path*>;" & _
"Extended Properties=""Exce
8.0;HDR=Yes"""

objExcelAdd.Open "SELECT * FROM [New To be added$]", cnnExcel, 1,
 
marsulein
If objExcel refers to an instance of Excel, how are you creating/assigning
it ? If true, then Excel does not have a ".Fields" property.

What is objExcelAdd ?

I'm a little confused as to what you are trying to do, so please clarify the
you want to get data from an Excel sheet in to VB using ADO ?

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top