Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy To excel question
Message
From
11/01/2006 09:03:38
 
 
General information
Forum:
Microsoft SQL Server
Category:
Import/Export
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01085186
Message ID:
01085592
Views:
17
Sorry, that probably should be ExcelA instead of ExcelW.

Here is an example from VFP showing two different techniques:

LOCAL ExcelA, ExcelW
ExcelA = CREATEOBJECT('Excel.Application')
ExcelW = ExcelA.Application.Workbooks.Open("C:\book1.xls")

* one method is to just autofit all columns
ExcelA.Columns.EntireColumn.AutoFit()

* another method is to select the columns, then autofit the selection
ExcelA.Cells.Select()
ExcelA.Selection.Columns.AutoFit()

ExcelA.DisplayAlerts = .f.
ExcelA.SaveWorkspace()
ExcelA.Application.Workbooks.Close()
ExcelW= NULL
ExcelA= NULL


Note that if you want to figure out the commands to do something like this in Excel, you can record your actions using Tools>Macros>Record new Macro and then view the commands using Tools>Macros>Visual Basic Editor.



>Thanks Mark,
>
> Are you sure the code is correct. I am getting error saying 'Object doesnot support this propert ExcelW.Columns.'
>
>Bharat
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform