General information
Forum:
Microsoft SQL Server
Environment versions
SQL Server:
SQL Server 2000
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
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