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

RE: VFP6: open excel file and dump to .dbf by Leemi

Leemi
Tue Aug 16 15:37:08 CDT 2005

Hi Ben:

Take a look at the IMPORT command or the IMPORT Wizard. If the table does
not have more the 16,000 rows, this should work.


I hope this helps.

This posting is provided "AS IS" with no warranties, and confers no rights.

Sincerely,
Microsoft FoxPro Technical Support
Lee Mitchell

*-- VFP9 HAS ARRIVED!! --*
Read about all the new features of VFP9 here:
http://msdn.microsoft.com/vfoxpro/

*--Purchase VFP 9.0 here:
http://www.microsoft.com/PRODUCTS/info/product.aspx?view=22&pcid=54787e64-52
69-4500-8bf2-3f06689f4ab3&type=ovr

Keep an eye on the product lifecycle for Visual FoxPro here:
http://support.microsoft.com/gp/lifeselectindex
- VFP5 Mainstream Support retired June 30th, 2003
- VFP6 Mainstream Support retired Sept. 30th, 2003

>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


Re: open excel file and dump to .dbf by Cindy

Cindy
Tue Aug 16 16:28:39 CDT 2005

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


"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
>
>



Re: open excel file and dump to .dbf by N

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
> >
> >
>
>