1,105,334 Community Members

Connection using Excel

Member Avatar
ImZick
Posting Whiz in Training
201 posts since Dec 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 4 [?]
Skill Endorsements: 4 [?]
 
0
 

Hi everyone

i have a connection to my sheet like this

Dim da As New OleDbDataAdapter("Select * from [EBU 2 LOB$]", con)

but i want to use this

Dim Sheet1_EBU as string = "EBU 2 LOB$"

so that the code will be something like this i think?

Dim da As New OleDbDataAdapter("Select * from [ & Sheet1_EBU &]", con)

but i have a error it said could not find the the object [ & Sheet1_EBU &]

How can i write it in a appropriate way?

Member Avatar
deceptikon
Eternally Awesome
4,671 posts since Jan 2012
Reputation Points: 1,341 [?]
Q&As Helped to Solve: 680 [?]
Skill Endorsements: 104 [?]
Administrator
Featured
 
0
 

so that the code will be something like this i think?

Close. You forgot to close the two strings:

Dim da As New OleDbDataAdapter("Select * from [" & Sheet1_EBU & "]", con)
Question Answered as of 1 Year Ago by deceptikon
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: