
Exporting Access tbl to Excel - Worksheet Names
Nothing seems obviously wrong with what you're doing. May I suggest a bit of
debugging? In your code that does this work, insert steps (Debug.Print
variablename) at various steps to print out the value of the string variable
that is used for the table name. See if you can find where the "change" is
occurring. That may help determine where/when/why it's happening.
--
Hoping that this is helpful...
Ken Snell
<MS ACCESS MVP>
Quote:
> Well, the strings being used for the worksheet tab names are first Table
> names in Access.
> The application basically does this:
> 1. reads in a text file containing model #'s and some associated
> information.
> 2. for each Model #, a table is created with the same name, and the
> associated data is then loaded into the table. (the reason for creating a
> separate table for each model is to provide the worksheet names when
> exported)
> 3. all the tables are then exported to a single workbook, with each
tables'
> data being placed in a separate worksheet
> In the process, each table in Access is created on the fly, then deleted
> once the data has been exported.
> Some of the table names are as follows:
> MS440
> MS220
> BG55
> FS55
> FS200
> MS034
> MS026
> etc....
> The only ones displaying the problem are those begining with "F" or "B".
> Very strange, but there has to be a reason for it!
> Thank-you for your reply.
> Scott
> >My experience is that the underscore is used to replace various
"nonnormal"
> >characters. Post some examples of the table names that get the underscore
> >and let's see.
> >--
> >Hoping that this is helpful...
> > Ken Snell
> ><MS ACCESS MVP>
> >> Hi,
> >> I have an Access97 database, from which I export a number of tables to
a
> >> single Excel97 workbook.
> >> The command for this is as follows (I loop through it several times for
> >> different tables):
> >> DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97,
> >> Trim(strTableName), strOutFile, True
> >> The problem occurs with the worksheet names in the resulting workbook.
> >Some
> >> are prefixed with an underscore ("_"), while others are not.
> >> I first thought it was because some of the table names began with a
> >zero(0),
> >> so I placed a character in front of the table name, but still, some
have
> >the
> >> underscore prefix.
> >> I have tried (as you can see from the command above) "T{*filter*}" the
table
> >> name before exporting, but again, same problem.
> >> Any suggestions?
> >> Thanks,
> >> Scott