We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,417 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Connection using Excel

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?

2
Contributors
1
Reply
3 Hours
Discussion Span
3 Months Ago
Last Updated
4
Views
Question
Answered
Zick Technology
Junior Poster
183 posts since Dec 2012
Reputation Points: 0
Solved Threads: 2
Skill Endorsements: 3

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)
deceptikon
Challenge Accepted
Administrator
3,457 posts since Jan 2012
Reputation Points: 822
Solved Threads: 474
Skill Endorsements: 57
Question Answered as of 2 Months Ago by deceptikon

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0622 seconds using 2.7MB