Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Working with an object
Message
From
11/01/2002 12:15:24
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00603527
Message ID:
00603582
Views:
22
>*!* Code
>
>lcFile="PICK01101.XLS"
>
>*!* Autosizing of columns added by Neil Sykes - 11/01/2001
>oleExcelPicklist = GETOBJECT(SYS(5)+SYS(2003)+"\"+LCFILE)
>
>oleExcelPicklist.Cells.Select *!* Crashing here
>oleExcelPicklist.Selection.AutoFit

Oh I never have been succesfull using getobject like that. Here is how I do it :
*1)
oleExcelPicklist = CreateOBJECT('Excel.Application')
with oleExcelPicklist
 .Workbooks.Open(SYS(5)+SYS(2003)+"\"+LCFILE)
 .Activeworkbook.ActiveSheet.Cells.Select   *!* Crashing here
 .Selection.AutoFit
 .visible = .t.
endwith

*2)
oleExcelPicklist = CreateOBJECT('Excel.Application')
with oleExcelPicklist
 .Workbooks.Open(SYS(5)+SYS(2003)+"\"+LCFILE)
 .Activeworkbook.ActiveSheet.UsedRange.Select
 .Selection.AutoFit
 .visible = .t.
endwith

*3)
oleExcelPicklist = CreateOBJECT('Excel.Application')
with oleExcelPicklist
 .Workbooks.Open(SYS(5)+SYS(2003)+"\"+LCFILE)
 .Activeworkbook.ActiveSheet.UsedRange.Columns.AutoFit
 .visible = .t.
endwith

*...
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform