How to export the currently open document into excel

How to export the fields of the currently open document to an excelfile name as excelexport.xls.In the excel file the top row must have the field values and second row must have field values for the corresponding names since only one document is exportedThe excelfile must be created in a specific directory and message must be displayed to the user.

thanks

with hope

Subject: How to export the currently open document into excel

Here is some code to create an Excel app with fillin g of some data:

Const APPLICATION_EXCEL = “Excel.Application”

Const SHEET_2 = “Sheet2”

Const SHEET_3 = “Sheet3”

Const xlContinuous = 1

Const xlEdgeBottom = 9

Const xlMedium = 3

Const xlR1C1 = 2

Set xlapp = CreateObject(APPLICATION_EXCEL)

xlapp.Visible = False

xlapp.Workbooks.Add

xlapp.ReferenceStyle = xlR1C1

xlapp.DisplayAlerts = False

xlapp.activeWorkbook.Worksheets(SHEET_2).Delete

xlapp.activeWorkbook.Worksheets(SHEET_3).Delete

Set xlsheet = xlapp.Workbooks(1).Worksheets(1)

xlsheet.Name = titlestr

xlsheet.Cells(row, 1).Value = “your value”

row = row + 1

xlapp.Cells.Select

xlapp.Cells.EntireColumn.AutoFit

xlapp.Range(“A1”).Select

You could adapt it to fill more cells and to save the sheet to a file.