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!

Export to Excel Template

Status
Not open for further replies.

Aliffi

MIS
Jan 9, 2005
51
BE
Dear All,

I want to export tables from database access to excel

but , i want to have a template ready made in excel
and when i do export the table records, it should go to that excel template file with pre formatted culmns

regards

 
You could export to a disposable excel file and have your formatted file linked to that one as its source of data. This solution works if the data you export is of a similar size each time.
 
Dear Payback,

what i said before , is what i seen somewhere , when they clickd the button all the records from access exported to excel template and automatically placed in the cells formated in excel

and i think it needs alot of codes

cheers
iam witing for reply thanks
 
I have used the following successfully

DoCmd.TransferSpreadsheet acExport, 8, "tablename", "\\server\folder\subfolder\spreadsheet.xls", False, ""


You can then run a macro in the spreadsheet to format and save the spreadsheet file. This code has worked through Access97 to Access 2003 for me.

Dim mno As String
Set XLApp = GetObject(, "Excel.Application")
If Err <> 0 Then
Set XLApp = CreateObject("Excel.Application")
End If
On Error GoTo Err_Handle
TemplateFile = "\\Server\Folder\Subfolder\spreadsheet.XLS"
XLApp.workbooks.Open TemplateFile
f = RunMacro("FormatFont")
XLApp.Application.Quit
Set XLApp = Nothing




Sandy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top