View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Retrieving data from Excel and store it into string variable

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


"marsulein" wrote in message
...

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=""Excel
8.0;HDR=Yes"""

objExcelAdd.Open "SELECT * FROM [New To be added$]", cnnExcel, 1, 1


--
marsulein
------------------------------------------------------------------------
marsulein's Profile:

http://www.excelforum.com/member.php...o&userid=16064
View this thread: http://www.excelforum.com/showthread...hreadid=275204