Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy Excel file to a existing Excel sheet
Message
From
13/09/2004 08:08:56
 
 
To
13/09/2004 07:23:48
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00939891
Message ID:
00941566
Views:
13
Hi Cetin

Thanks.

>oExcel.DisplayAlerts = .f.
>oExcel.ActiveWorkbook.SaveAs('c:\mypath\NewXLSName.xls') && If you wnat to rename XLS
>
>oExcel.Activeworkbook.ActiveSheet.Name = 'NewName' && If you want to rename sheet
>or something like:
>oExcel.Workbooks(nIndex).Sheets('OldName').Name = 'NewName' && If you want to rename sheet
>Cetin
>
>>Hi Cetin
>>
>>Thanks. It´s working.
>>
>>But now I have another "small" problem
>>
>>After using Bookworks.add
>>
>>How do I rename the new Excel docunent and how do I save it? I have tryied Bookworks.name and Bookworks.save but both returns errors.
>>
>>Hope you can help me with this.
>>
>>
>>>>HI
>>>>
>>>>I have a blank Excel sheet and I want to copy an existing Excel file into this sheet.
>>>>
>>>>How can it be done ??
>>>
>>>
lcXLSFrom = "C:\myPath\mySource.xls"
>>>lcFromSheet = 'MySourceSheet'
>>>LOCAL loExcel,loRange
>>>loExcel = CreateObject("Excel.Application")
>>>with loExcel
>>> .Workbooks.Open(lcXLSFrom)
>>> loRange = .ActiveWorkbook.Sheets(lcFromSheet).UsedRange
>>> .Workbooks.Add
>>> loRange.Copy(.ActiveWorkbook.ActiveSheet.Range('A1'))
>>> .WorkBooks(1).Close
>>> .Visible = .T.
>>>ENDWITH
Cetin
Benn Kjaer
MS Certified Professional - Visual Foxpro

"There is something rotten in the state of Denmark"
"Why make user-friendly programs, when there aren’t any friendly users :o)"
Previous
Reply
Map
View

Click here to load this message in the networking platform