General information
Category:
COM/DCOM and OLE Automation
Hi,
I just gave you a snapshot. Below is more detail. The code below is just a sample. It isn't going to be code you can take and directly apply to your application. It shows some different approaches to your problem.
This piece of code opens a file called 'Open Order Report.xls' the creator of this .XLS file knows to put "SHEETEND" into the last Row of Column lnSymbolCol to flag that there are no more rows to check. lnSymbolCol is the holder of the a passed parameter.
loxls = This.oCOMServer
lcOpenOrdersFile = GETFILE('XLS', 'Open Order Report.xls')
WITH loxls
.Workbooks.Open(lcOpenOrdersFile)
.Range("A3").Select
.Visible = .T.
lnRow = 3
lcSymbol = .Cells(lnRow, lnSymbolCol).VALUE
DO WHILE TYPE( 'lcSymbol' ) <> 'C' && skip over the empty cells
lnRow = lnRow + 1
lcSymbol = .Cells(lnRow, lnSymbolCol).VALUE
ENDDO
DO WHILE lcSymbol <> "SHEETEND"
.Range("S"+ ALLTRIM(STR(lnRow,5)) ).Select
ldOpenDate = .Cells(lnRow, lnOpenDateCol).VALUE
lnRow = lnRow + 1
lcSymbol = .Cells(lnRow, lnSymbolCol).VALUE
DO WHILE TYPE( 'lcSymbol' ) <> 'C'
lnRow = lnRow + 1
lcSymbol = .Cells(lnRow, lnSymbolCol).VALUE
ENDDO
ENDDO
.ActiveWorkbook.SaveAs(lcOpenOrdersFile,-4143, "", "", .F., .F. )
.Activeworkbook.close()
ENDWITH
HTH,
Jacci
>Nope this code did not work...I got errors that the lcSymbol=..... must be within and with/endwith...
>
>I guess I will keep plugging...I did post my code above if you can check it out maybe you could help more....Thanks again....
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only