Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format problem between Excel 97 and 2000

Status
Not open for further replies.

davideart

Programmer
Apr 4, 2001
55
IT
Hi everybody

We got an Access procedure that fills an Excel sheet (.xlt) with a recordset from an access table.
The Excel sheet has particular formats for specific cells/columns.

Everything goes well with Excel 97, whereas, using excel 2000, formats are completely lost.

Here's the code we wrote to do the export:
Code:
'''''''''''''''''''''''''''''''''''''
'create recordset and set excel sheet properties
'''''''''''''''''''''''''''''''''''''''

StrSql = "select * from TABLE"
Set RsXls = CurrentDb.OpenRecordset(StrSql, dbOpenSnapshot)
    
    oApp.Workbooks.Add Template:=XLTMODELNAME
    
    With oApp.ActiveSheet.QueryTables.Add(Connection:=RsXls, Destination:=oApp.Range("A10"))
        .FieldNames = False
        .RefreshStyle = xlOverwriteCells
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .RefreshOnFileOpen = False
        .HasAutoFormat = False
        .BackgroundQuery = True
        .TablesOnlyFromHTML = True
        .Refresh BackgroundQuery:=False
        .SavePassword = True
        .SaveData = False
    End With
    RsXls.Close
    
''''''''''''''''''''''''''''''''''''''''''''''''''
'export
'''''''''''''''''''''''''''''''''''''''''''''''
 oApp.ActiveWorkbook.SaveAs FileName:=NomeFileCompleto _
            , FileFormat:=xlExcel5, PASSWORD:="", WriteResPassword:="", _
            ReadOnlyRecommended:=False, CreateBackup:=True
If client PC has got Excel 2000, all cells and columns formats are lost.

Thank in advance for every help, bye.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top