|
-
Mar 25th, 2003, 12:35 PM
#1
Thread Starter
Member
Excel
Can i export data from a file to a template in excel?
-
Mar 25th, 2003, 12:51 PM
#2
You can import data from a file using a template in Excel, then save this with all of the template's formatting etc intact - this could be one way to achieve what you're looking for...
-
Mar 25th, 2003, 01:02 PM
#3
Here's one quick example, this opens up excel & then opens a saved template file. Data is copied in (this one is just copying in data from a recordset assumed to be already opened & populated), and the file - with the formatting and data is then saved as a standard *.xls file to a separate folder - should be the type of thing you're after...
VB Code:
Private Sub CommandButton1_Click()
Dim objXLApp As Excel.Application
Set objXLApp = New Excel.Application
With objXLApp
.Workbooks.Open "C:\Path\TemplateFile.xlt"
.Workbooks(1).Sheets("Sheet1").Range("A1").CopyFromRecordset RecordsetVariable
.Workbooks(1).SaveAs "C:\Path2\StandardExcelFormatFile.xls"
.Workbooks(1).Close
.Quit
End With
Set objXLApp = Nothing
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|