Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: stephanie smith
  Where is stephanie smith?
 billingham
 United Kingdom
 stephanie smith
 Tags
Subject: VFP 8 and Excel
Thread ID: 269091 Message ID: 269091 # Views: 29 # Ratings: 0
Version: Visual FoxPro 8 Category: Helpfiles
Date: Friday, July 16, 2010 11:37:43 AM         
   


Hello,

I know this is probably a simple and stupid question, but I've been trying to import data from a .dbf file into excel. I have some code from the macro I eventualy want to use but have come across a problem that the fille will not even open properly in Excel, well, it opens but says the file format is unrecognizable and shoves all the data into one cell. I've been told it's because of the version of VFP the .dbf was created but is there a way around this to get excel to open the file correctly?

Here is the code I will be useing;

Sub Auto_Open()
' This macro will put today's date as the default new tab name
Sheets("Menu").Select
Range("C4").Select
Selection.Formula = "=text(now(),""mmm dd yyyy"")"
Selection.Copy
Selection.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
Selection.Columns.AutoFit
Range("B9").Value = ""
End Sub

Sub GetFile()
' This macro will import a file into this workbook
' Copyright 1999 www.MrExcel.com
Sheets("Menu").Select
PathName = Range("C2").Value
fileName = Range("C3").Value
TabName = Range("C4").Value
ControlFile = ActiveWorkbook.Name
Workbooks.Open fileName:=PathName & fileName
ActiveSheet.Name = TabName
Sheets(TabName).Copy After:=Workbooks(ControlFile).Sheets(1)
Windows(fileName).Activate
ActiveWorkbook.Close SaveChanges:=False
Windows(ControlFile).Activate
''Sheets("Menu").Select
'Range("B9").Select
'ActiveCell.Value = "Completed"
'Range("B10").Select
End Sub

End Sub

Any help is greatly apriciated, and thanks again.

ENTIRE THREAD

VFP 8 and Excel Posted by stephanie smith @ 7/16/2010 11:37:43 AM
RE: VFP 8 and Excel Posted by Mike Gagnon @ 7/16/2010 11:58:58 AM
RE: VFP 8 and Excel Posted by Samir H. @ 7/16/2010 12:02:10 PM
RE: VFP 8 and Excel Posted by stephanie smith @ 7/16/2010 12:08:25 PM
RE: VFP 8 and Excel Posted by Samir H. @ 7/16/2010 12:14:58 PM
RE: VFP 8 and Excel Posted by Mike Gagnon @ 7/16/2010 12:16:58 PM
RE: VFP 8 and Excel Posted by Nivedita Joshi @ 7/16/2010 12:18:18 PM
RE: VFP 8 and Excel Posted by Anders Altberg @ 7/16/2010 1:42:07 PM