General information
Category:
COM/DCOM and OLE Automation
Title:
Excel automation 101
I'm using VFP 6.0 as the interface, and Excel as the data storage tool. My questions are:
1) are certain VBA methods not available to FoxPro?
2) how would I go about adding a new record to an existing Excel sheet?
I've created a form-based object createobject'ed in the Form Load called oEx
(for 'Excel object'). In the UDF MakeLists() I have the following
statements:
nClientNum = .oEx.Sheets("Clients").Range("A3").Value
What's so cool to this newbie to automation is that this actually works.
Well, it seems not all VBA commands are going to work, however (please
correct me if I'm wrong!), for instance, in the Save Button Click() method,
I have the following statement:
cSheet = SUBSTR(CMONTH(THISFORM.TxtDate.Value),1,3)
WITH THISFORM.oEx
* Pick the appropriate worksheet
.Sheets(cSheet).Select && works
* Insert a row
.Rows("5:5").Select && works
.Sheets.Selection.Insert Shift:=xlDown && generates a compile error
ENDWITH
Thanks for taking the time to ponder my situation and possibly offering a
solution. I'm happy to study a FAQ - this seems to be the kind of question *someone* must have asked before, but I've found nothing so far in my searches of UT FAQs ...
Regards,
Robin
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only