Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Importing a spreadsheet-like HTML file
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01155024
Message ID:
01155041
Views:
30
>>>>Is it possible to import an HTML file, in a spreadsheet-like format, directly into a VFP table? It's not in the syntax of VFP7's import or copy to.
>>>>
>>>>I guess I need to manually convert it to XLS, or delim (or whatever) first?
>>>>
>>>>'ppreciate it
>>>>
>>>>Terry
>>>
>>>Directly, no.
>>>But you could use Automation to open that HTML in Excel, save it as usual XLS file and then import it in VFP.
>>
>>Thanks Boris
>>
>>I presume that once I've created the excel object I use, like, loExcel.Open ( lcMyFileName) ?
>>
>>Terry
>
>
>#DEFINE xlNormal -4143
>
>oExcel.Open([...........]) && Full path and file name of HTML file
>oExcel.ActiveWorkBook.SaveAs([Test.XLS],xlNormal)
>
>
>Not tested.

Thanks BB

I just opened the HTML in Excel, did some reformatting and saved it, whilst recording a macro, and came up with:
Workbooks.Open Filename:= _
        "R:\OPDATA\Essex\SM_Coaches\APR06\sm coaches disk.htm"
... reformatting code
ActiveWorkbook.SaveAs Filename:= _
        "R:\OPDATA\Essex\SM_Coaches\APR06\sm coaches disk.xls", FileFormat:= _
        xlExcel9795
Now this differs a bit from your code (which you say isn't tested). I was wondering if the VB code needs to be changed, e.g. the ":=" to "=", or if your example is what will work in VFP, as opposed to the macro code. For example, the "_" at the end of the first line, is that like a line continuation mark, and would that need to be replaced with ";"?

This is very interesting and satisfying, isn't it, once you get into it :-)

Terry
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform