Posted By

goo on 10/16/08


Tagged

excel access


Versions (?)

ACCESS Create Excel document


 / Published in: Visual Basic
 

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

  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

Report this snippet  

You need to login to post a comment.