Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Open Excel sheet
Message
From
23/11/2004 05:08:47
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
23/11/2004 04:39:23
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00963741
Message ID:
00963746
Views:
7
>hi all,
>
>i need to open excel sheet from another directory or server,
>via myform'
>and modify some operatins at excel sheet,and return back to mydirectory(myform).
>
>thanks
>m.qasem
>via myform

Mohammed,
Not clear what you mean. Below sample:
-Creates excel file c:\temp\myFile.xls with names from testdata!employee
-Opens that xls file
-Inserts customer Company, Contact names starting from D5 as top left corner, autoformats the inserted section with one of colorful formats and shows xls
Note that you don't need to change default directory.
local lcXLSFile,lcTemp
lcXLSFile = "c:\temp\myFile.xls"
select First_Name, last_Name from employee into cursor crsTemp
copy to (m.lcXLSFile) type xls
Select Company,Contact from customer into cursor crsTemp
lcTemp = sys(2015)+'.tmp'
copy to (m.lcTemp) type delimited with "" with tab
_cliptext = "Company"+Chr(9)+"Contact Name"+Chr(13)+FileToStr(m.lcTemp)
erase (m.lcTemp)
use in "crsTemp"

#define xlRangeAutoFormatColor2 8
oExcel = createobject("Excel.Application")
with oExcel
 .WorkBooks.Open(m.lcXLSFile)
 With .ActiveWorkBook.ActiveSheet
 	.Range("D5").PasteSpecial
 	.Application.Selection.Columns.Autoformat(xlRangeAutoFormatColor2)
 	.Range("A1").Activate
 endwith
 .Visible = .T.
endwith
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