Information générale
Forum:
Microsoft SQL Server
Versions des environnements
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
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement