N
Wed Aug 17 09:00:28 CDT 2005
"Cindy Winegarden" <cindy_winegarden@msn.com> wrote in message
news:OH2WLpqoFHA.3552@TK2MSFTNGP10.phx.gbl...
> Hi NL,
>
> In addition to challenging questions, we're always happy to help with
> ordinary, boring, or simple questions. And, we love newbies! :-)
>
> Another way is to use Excel Automation. To find out the commands you need,
> open Excel, start recording a macro, and then do what you need. After
that,
> stop the macro and read the VBA code in the VBA Editor. It will give you a
> good start toward the VFP code.
>
> When you import, watch out for numeric fields formatted with commas, etc.
>
> Here's some code:
>
> oExcel = CreateObject("Excel.Application")
> With oExcel
> .Visible = .T. && For testing
> oBook = .Workbooks.Add("C:\Temp\MyXLS.xls")
> .ActiveCell.SpecialCells(11).Select() && Excel constant xlLastCell =
11
> .Range(Selection, Cell(1)).Select()
> oSelection = .ActiveCell && Something like "$D$6"
> *-- This one was a little tricky
> .Range("&oSelection:A1").Select() && Select the data you want in your
> DBF
> oBook.SaveAs("C:\Temp\MyDBF.dbf", 11) && Excel constant xlDBF4 = 11
> .Quit
> EndWith
> *-- Release variables, etc.
>
> Note, when you're testing you may end up with invisible instances of
Excel.
> Use the Task Manager to find them and end them. When I was learning I
would
> easily end up with 10 instances of Excel!
>
>
> --
> Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
> cindy_winegarden@msn.com www.cindywinegarden.com
> Blog:
http://spaces.msn.com/members/cindywinegarden
This is exactly what I was looking for, thank you!
>
>
> "N.L.Junkie" <N.L.Junkie@anon.com> wrote in message
> news:mTrMe.8553$32.4845@tornado.rdc-kc.rr.com...
> > Need to open a spreadsheet (Excel 2k) and dump contents to .dbf file
using
> > VFP6. Pretty generic really, sorry if this request isn't a challenge!
> > Any
> > sample type code would be appreciated.
> >
> > - Ben
> >
> >
>
>