>>loExcel = CREATEOBJECT([Excel.Application]) >>Wait WINDOW "Opening HTML File ..." NOWAIT NOCLEAR >>With loExcel >> .Workbooks.Open( "R:\OPDATA\Essex\SM_Coaches\APR06\sm coaches disk.htm") >> Wait WINDOW "Saving as Excel Spreadsheet ..." NOWAIT NOCLEAR >> .ActiveWorkBook.SaveAs("Test.XLS", xlNormal) >> Wait CLEAR >>* For Now> With .ActiveSheet >> .Rows("1:4").Select >> .selection. >>* For Now> .Selection.Delete Shift=xlUp >> .Selection.FormatConditions.Delete >> .Columns("C:C").Select >>* For Now> .Selection.Delete Shift=xlToLeft >> .Selection.FormatConditions.Delete >>>>In the above lines (note I've commented out the With .activesheet line - so now I'm getting further).
>#define xlUp -4162 >#define xlToLeft -4159 >#define xlNormal -4143 > > >** Put this so Intellisense to be activated >LOCAL loExcel AS Excel.Application > >loExcel = CREATEOBJECT([Excel.Application]) > > >*** If you want to see what happens add this line >loExcel.Visible = .t. > >Wait WINDOW "Opening HTML File ..." NOWAIT NOCLEAR >loExcel.Workbooks.Open( "R:\OPDATA\Essex\SM_Coaches\APR06\sm coaches disk.htm") > >*** Turn of all warnings >loExcel.DisplayAlerts = 0 > >**** Select and delete rows from one to 4 >loExcel.Range([1:4]).Delete(xlUp) > >**** Select and delete Column C >loExcel.Range([C:C]).Delete(xlToLeft) > >*** Save the file AFTER you made all changes >loExcel.ActiveWorkBook.SaveAs("Test.XLS", xlNormal) > >*** Close the file. You leave it opened, that is why you get that error message >*** If you call Task manager you will see several EXCELs running :-) >loExcel.ActiveWorkBook.Close() > >*** QUIT the Excel >loExcel.Quit() > >loExcel = NULL >RELEASE loExcel > >*** AND CLEAR WAIT WINDOW :-))))))) >WAIT CLEAR >