Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

Worksheet name problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dogbert - 24 Mar 2006 00:52 GMT
I use excel driver to retrieve the data (not allowed to use excel object
libaray), the worksheet name seems cannot contain any space(ie. "worksheetname"
but not "worksheet name") . Is this can be solved ?

   cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties='Excel
8.0;HDR=Yes;IMEX=1';Data Source=........"

   cn.CursorLocation = adUseClient

sSQL = "select * from ['worksheetname$'A1:B10]"

   rs.Open sSQL, cn

THANKS ALL~~~
idyllicabyss@googlemail.com - 24 Mar 2006 01:22 GMT
The worksheet name should be able to include spaces if you enclose it
in speechmarks the same as if you were referencing it any other time in
VBA.
Otherwise try refering to the sheet directly via it's (name) rather
than it's name, eg sheet1.
For instance, ,although Sheet1 is renamed "User Data", it can still be
referred to explicity as Sheet1 without the speechmarks, as long as
it's (name) has not been changed.
If this doesn't make sense, open VBA and view the properties for any
sheet, you should see (Name) at the top of the list and Name just after
EnableSelection.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.