ACCESS Create Excel document


/ Published in: Visual Basic
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Public Sub CreateExcelSheet()
  2. Dim ExcelSheet As Object
  3.  
  4. On Error goto CreateExcelSheet_Err
  5.  
  6. Set ExcelSheet = CreateObject("Excel.Sheet") _
  7. ExcelSheet.Application.Visible = True
  8.  
  9. ExcelSheet.Application.Cells(1, 1).Value = "This is Column A, _
  10. row 1"ExcelSheet.SaveAs "C:\TEST.XLS"
  11. ExcelSheet.Application.Quit
  12.  
  13. Set ExcelSheet = Nothing
  14.  
  15. CreateExcelSheet_Exit:
  16. Exit Sub
  17.  
  18. CreateExcelSheet_Err:
  19. Msgbox Err.Description,,"CreateExcelSheet"
  20. Resume CreateExcelSheet_Exit
  21.  
  22. End Sub

URL: http://www.msaccesstips.com/2006/12/create-excel-word-file-from-access.shtml

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.