Xlsx to DBF

I want to convert a xlsx to dbf with COM technology (office automation) on a system which has Office 2003, not 2007. The process has to be invisible to the user. It can be assumed that the user has the compatibility pack installed.

I will use the solution in Foxpro, but a solution of the xls/xlsx problem in vb is ok.

Can this be accomplished?
krhagAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GreatSolutionsC.I.OCommented:
Visual Foxpro Code:

xlsxFileName = GETFILE( "Excel Files:XLSX" )

oxl = CreateObject("Excel.Application")
if vartype(oxl) != "O"
  * could not instantiate Excel object
  return .F.
endif

* make excel visible during development
*oxl.visible = .T.

* open the workbook
oxl.SheetsInNewWorkBook = 1
oWorkbook = oxl.Workbooks.Open(xlsxFileName)

* save as DBF (i use here DBASE 3 compatible DBF)
oWorkbook.SaveAs( "blablabla.dbf", 8 )
* use 11 instead of 8 for DBASE 4 compatibility

release oxl
0
krhagAuthor Commented:
The problem is that the suggested solution works only if Excel 2007 is installed - my scenario is that I want to use office automation on a xlsx with only Office 2003 installed.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

mikegagnonCommented:
krhaq:

The solution I propose seems to suggest that Office 2007 does not need to be installed.

•Does not require Office 2007
•Can append from xls, xlsx, xlsm, and xlsb file formats
•Can create and copy to xls, xlsx, xlsm, and xlsb file formats
•Supports all Excel tables (worksheets, ranges, and printable regions)
•Allows target worksheet columns and table fields to be specified
•Allows header row in worksheet to have spaces in the names of the columns by enclosing them in standard brackets, for instance [My Column #1]
•Provides support for SQL Where clause or VFP For clause expressions
•Is super fast
•Probably does a few other things I'm not thinking of right now :)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GreatSolutionsC.I.OCommented:
What i suggested will work if Office 2003 is installed, and you stated in your first post compatibility pack is installed, so xlsx is automatically opened by 2003.
On the other hand, in my opinion, the solution provided by Mike, which has been developed by the venerable Craig Boyd, is the best solution ever for your problem.
0
krhagAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.