Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Luca Moioli
  Where is Luca Moioli?
 Venezia
 Italy
 Luca Moioli
 Tags
Subject: THISFORM can only be used within a metho
Thread ID: 345164 Message ID: 345164 # Views: 39 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Microsoft Office Automation
Date: Saturday, May 19, 2012 9:29:28 AM         
   


Dear friends,
I have a procedure using Excel.
In the form's Init I initialize Excel object:


thisform.oExcel=CreateObject("Excel.Application")
thisform.oBook=thisform.oExcel.Workbooks.Open(m.dir_xls+"CONFERME.xls")
thisform.oBook.WorkSheets(1).Activate()


When I call .Cells.Find method

			SCAN all
				WITH thisform.oBook.WorkSheets(1)
					.Cells(1,1).Select
					IF NOT EMPTY(MyValue)
						m.MyValue=chrtran(ALLTRIM(MyValue),CHR(96),"'")
						wait window nowait noclear m.MyValue
						IF .Cells.Find(ALLTRIM(m.MyValue)).Activate
							.Cells(thisform.oExcel.ActiveCell.Row,16).Value="ok"
						ENDIF
					endif
				ENDWITH 
			endscan


I get a strange error:

THISFORM can only be used within a method (Error 1929)

Please, what is wrong?
Thank you very much

ENTIRE THREAD

THISFORM can only be used within a metho Posted by Luca Moioli @ 5/19/2012 9:29:28 AM
RE: THISFORM can only be used within a metho Posted by Suresh Adhikari @ 5/19/2012 11:14:31 AM
RE: THISFORM can only be used within a metho Posted by Luca Moioli @ 5/19/2012 3:40:42 PM