Creating a spreadsheet from Foxpro using Object Model

S

Scott

With the push from a button on one of my FoxPro forms
using the Excel automation (object model), I create an
employee listing on a spreadsheet that will be sent to a
client. I protect the sheet so that the client cannot edit
the listing, but I want them to be able to add a NEW entry
(employee) into the listing if needed. So, in the VFP code
that's creating the spreadsheet, I want to add a button
that will:

-Unprotect the spreadsheet
-Insert a new row and "unlock" that row
-Protect the spreadsheet again with the password

I think I know how to add a button to the spreadsheet
through my code, but I don't know how to add the 'Click'
event code for the button from within my VFP code.

I've read the 'MS Office Automation with VFP' book and it
doesn't help.

This has to be entirely automated (no actual Excel
interaction).

Please help...any examples (VBA or VFP code) would be
welcome.
 
D

Dick Kusleika

Scott

If you're using the OLE commandbutton, then have a look here.

http://www.cpearson.com/excel/vbe.htm

You need to find the correct VBComponent (the sheet on which the button will
be inserted) and add code to its CodeModule like

Private Sub CommandButton1_Click()
'Stuff
End Sub

You may want to do it manually to see the correct syntax for the Click
event. Post back if you get stuck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top