Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COM a SPECIFIC Excel file into a VFP Form?

Status
Not open for further replies.

Docpro777

Programmer
Joined
Jul 1, 2003
Messages
105
Location
US
While I can COM a specific Excel file as follows:
oExcelSheet=Createobject("excel.application")
oExcelSheet.workbooks.Open(myExcelFile) && a memvar path

I can't find an Excel COM object in object browser that correctly opens "myExcelFile" above INTO a VFP form.

(There are Excel-like spreadsheet COM objects that are not viable)

Any suggestions from any of you familiar with Excel and COM?

Thanks

Philip M. Traynor, DPM
 
Docpro777

Its unclear what you need, do you need an Excel activex to show you an Excel sheet on a VFP form or do you need to automate Excel itself and bring it up?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
On my meager terms I need:

Either
1) an activex ON the VFP FORM that allows to direct into it:
oExcelSheet=Createobject("excel.application")
oExcelSheet.workbooks.Open(myExcelFile)

2) Or to automate it and bring it to a form's borders.

(Hope that isn't confusing).

Basically I want to open an EXISTENT excel file inside a VFP form.

Thanks for your interest,

Philip M. Traynor, DPM
 
Docpro777

1.Automating Excel creates an instance of Excel, which means it will be a separate application, not embeddable.
2. Embedding an Activex is the only way I know, here is an example:
Code:
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
	Top = 0
	Left = 0
	Height = 555
	Width = 727
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
       ADD OBJECT olecontrol1 AS olecontrol WITH ;
		Top = 12, ;
		Left = 36, ;
		Height = 517, ;
		Width = 649, ;
		Name = "Olecontrol1",;
		OleClass = "Excel.sheet.8"
ENDDEFINE

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Sorry late in responding. I've been out of town.

I've embedded the Activex as well and copied excel files to it cell by cell and found it not very aesthetic nor smart.

Alas I now merely copy cells to VFP records and during the 'save' do export the table back to the excel (mileage) workbook file.

Its doing pretty well. Thanks again Mike for your thoughtful and swift reply.

Philip M. Traynor, DPM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top