Haven't tested this recently but some notes in old code of mine say that if
special characters are involved, the syntax would be:
" 'My Sheet!' "
*The spaces between single and double quotes in the above are only for
syntax clarity and should be removed (i.e, s/b "' and '").*
I'm sure that the !' sequence is the key reason for me leaving that note to
myself, so maybe:
"'Pricing 2008!'A2:U300"
If I remember correctly, using this syntax when there are no special
characters in the name will cause an error (after all, why should anything
like referencing an Excel sheet be simple?). I didn't think that spaces
qualified as special characters, but since you are having problems, I
thought I'd toss this out in case its of any help. (It might be that the
worksheet has what *appears* to be a space, but is actually a special
character in disguise, in which case this might do the trick).
--
HTH,
George
Using my testing worksheet name of
"Pricing 2008!A1:I10"
your "Pricing 2008!A2:U300" should work.
I'll assume that your strUsFile is the same in both instances.
Are you sure the spreadsheet type is 8?
What error message do you get?
Why do you assume it's the space in the worksheet name causing the
failure?
Is "Temp_SB_Pricing" an existing table? Perhaps there is a problem
with the existing field names not matching the imported spreadsheet
names.
Change your table name code to "tblImportTest" and see if the data is
imported into this new table.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail- Hide quoted text -
- Show quoted text -
Thanks for the help, Fred!
The error I am getting is "Syntax error (missing operator0 in query
expression 'Pricing 2008$A2:U300'.
The message shows a $ in place of the ! that I actually used.
I am not sure if that means anything.
Also, I am not importing into an existing table. And, I am just going
with the field names that are automatically assinged.
I am using spreadsheet type 8
The strUsFile is the same in both instances: that is the directory
path and file name.
The only reason I think it has to do with the spaces is because when I
rename the worksheet name without spaces, then try it referring to the
name without spaces. . . it works. Also, the problem only exists when
I am dealing with spreadsheets with spaces in the names.
Perhaps, there is some other syntax that needs to be used ie,
brackets, apostrophe, etc. that the worksheet object requires to refer
to it whenever it has spaces.
I don't know . . . just thinking outloud to bounce that off of what
you think.
Thanks,
Coby.