Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLE with Excel - I'm stumped
Message
From
27/06/2003 11:26:22
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00804575
Message ID:
00804721
Views:
41
>Cetin
>
>This code always puts the paste into worsheet1 - fantastic
>
>this._webBrowser41.Navigate2('file://j:\global\mertest.xls')
>
>*Once you do this you've access to excel's object model too. ie:
>
>oXLS = thisform._webbrowser41.object.document
>
>oExcel = oXLS.Application
>
>*oExcel.Application.ActiveWorkbook.Save()
>
> lcTempFile = sys(2015)+".txt"
>copy to (lcTempFile) delimited with TAB
>_cliptext = filetostr(lcTempFile)
>erase (lcTempFile)
>
>oExcel.ActiveWorkBook.ActiveSheet.Range("g8:g19").PasteSpecial()
>_Cliptext = "" && Empty clipboard
>oExcel.Application.ActiveWorkbook.Save()
>
>How do I make the active worksheet worksheet 2 (its name is LON Per)?
>
>Colin

Colin,
*Make sheet the active one and paste
with oExcel.ActiveWorkBook
  .WorkSheets('LON Per').Activate
  .ActiveSheet.Range("g8:g19").PasteSpecial()
endwith

*Paste and make the active one - IOW need not be the active one
with oExcel.ActiveWorkBook
  .WorkSheets('LON Per').Range("g8:g19").PasteSpecial()
  .WorkSheets('LON Per').Activate
endwith
PS: You actually don't need to specify range as g8:g19 but just g8. It'd paste in g8:g19 (you've one row of 12 elements as I understand).
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