Sure, just make a report containing text fields which refer back to the form (i.e., "=Forms!MyForm!Field1". Then, on the On Click event for the button, use this code:
' Set object variable equal to the OLE object.
Set xlApp = CreateObject("Excel.Application"
Set mysheet = xlApp.Workbooks.Open("c:\someFile.xls".Sheets(1)
' Put the values in the Excel Cells:
'column 1:
mysheet.Cells(1, 1).Value = ""
mysheet.Cells(2, 1).Value = "asdasda"
mysheet.Cells(3, 1).Value = "asdasda"
mysheet.Cells(4, 1).Value = "asdas"
mysheet.Cells(5, 1).Value = "asdads"
mysheet.Cells(6, 1).Value = "asdas"
mysheet.Cells(7, 1).Value = "asdas"
' sheet, and quit Microsoft Excel.
mysheet.Application.Windows("someFile.xls".Visible = True
mysheet.Application.ActiveWorkbook.Save
mysheet.Application.ActiveWorkbook.Close
xlApp.Quit
Shell ("EXCEL.EXE C:\someFile.xls"
' Clear the object variable.
Set mysheet = Nothing
Set xlApp = Nothing
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.