when USING Microsoft.Office.Interop.Excel.Application at beginning of .prg I get the following error:
XS0144: Cannot create an instance of the abstract type or interface 'Microsoft.Office.Interop.Excel.GroupBox'
I think the reason is that a VO.Groupbox is already defined so I removed the USING directive and changed my code like that:
Code: Select all
LOCAL oExcel AS Microsoft.Office.Interop.Excel.Application
LOCAL oWorkSheet AS Microsoft.Office.Interop.Excel.Worksheet
LOCAL oRange AS Microsoft.Office.Interop.Excel.Range
LOCAL oFont AS Microsoft.Office.Interop.Excel.Font
LOCAL oWorkBooks AS Microsoft.Office.Interop.Excel.Workbooks
//... some other code
oExcel := Microsoft.Office.Interop.Excel.Application{}
oExcel:Visible := TRUE
oExcel:ScreenUpdating := FALSE
oWorkBooks := oExcel:Workbooks
oWorkBooks:OpenText(cFile, uOrigin, uStartRow, uDataType, uTextQualifier, uConsecutiveDelimiter, uTab, uSemicolon, uComma,uSpace, uOther, uOtherChar, uFieldInfo)
oWorkSheet := oExcel:ActiveSheet
oRange := oWorkSheet:Range[cCol,cRow]
oRange:SELECT()
oFont := oRange:Font
oFont:Name := "Courier New"
oFont:Size := 10
oFont:Strikethrough := FALSE
oFont:Superscript := FALSE
oFont:Subscript := FALSE
oFont:OutlineFont := FALSE
oFont:Shadow := FALSE
oRange:Columns:AutoFit // Adatta automaticamente le colonne
oRange := oWorkSheet:Range[ "A1","A1"]
oRange:SELECT()
XS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
on this line:
Code: Select all
oRange:Columns:AutoFit // Adatta automaticamente le colonne
thanks
Stefano
P.S. I'm getting another error on this line of code
Code: Select all
oWorkSheet:PageSetup:Orientation := 2 // xlLandascape