Export then do some formatting in Excel

Following my post yesterday! I am working to export some documents to Excel (csv file), then do some formatting in Excel.So it starts, in a view button:

@Command([FileExport]; “Comma Separated Value”;

“C:\Temp\LOVexport.csv”);

@UpdateFormulaContext;

@Command( [Execute] ;

“C:\Srccode\wins\O2K3\FILES\PFILES\MSOFFICE\OFFICE11\EXCEL.EXE” ;

“C:\Temp\LOVexport.csv” );

@UpdateFormulaContext;

@PostedCommand([ToolsRunMacro];“FExcel”)

Then, I am running the FExcel agent, copied at the end of this post, but it is getting the following error:

Instance Member ACTIVEDOCUMENT does not exist

'-------

' FormatMacro Macro

’ Macro recorded 22/02/2007 by 3M

’

’

Dim Excel As Variant

Dim Exceldoc As Variant



Set Excel = CreateObject("Excel.Application") 'Create Excel object

Set Exceldoc = Excel.activedocument 'Get a handle for the active document



Dim xlrange As Variant

Dim xlColumns As Variant

Dim xlGeneral As Variant

Dim xlBottom As Variant

Dim xlContext As Variant



xlrange=2

xlColumns=2

xlGeneral=1

xlBottom=-4107

xlContect=-5002



xlRange("M2").Select

With Selection

	.HorizontalAlignment = xlGeneral

	.VerticalAlignment = xlBottom

	.WrapText = False

	.Orientation = 0

	.AddIndent = False

	.IndentLevel = 0

	.ShrinkToFit = False

	.ReadingOrder = xlContext

	.MergeCells = False

End With

xlRange("M3").Select

xlColumns("M:M").EntireColumn.AutoFit

ActiveWindow.SmallScroll ToRight=6

xlColumns("M:M").Select

With Selection

	.HorizontalAlignment = xlGeneral

	.VerticalAlignment = xlBottom

	.WrapText = True

	.Orientation = 0

	.AddIndent = False

	.IndentLevel = 0

	.ShrinkToFit = False

	.ReadingOrder = xlContext

	.MergeCells = False

End With

ActiveWindow.SmallScroll ToRight=0

Selection.Columns.AutoFit

End Sub

'----

'This code is giving ‘Instance Member ACTIVEDOCUMENT does not exist’

Any ideas?

Subject: Export then do some formatting in Excel

FORGET IT I HAVE RESOLVED BY CHANGING Excel.activedocument TO

Set Exceldoc = Excel.ActiveWorkbook