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:
01155118
Views:
36
>>>>>>>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.
>...
>
>>>>#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 :-)
>>>
>
>BB
>
>Thanks as usual
>
>>>Terry
>>
>>
>>It differs because Excel Macro uses named parameters, you can't do that in VFP. VFP uses only positioned ones.
>>
>>[:=] must be changed to [=] && But you can't use it here
>>[_] is the next line marker and you are right, this is [;] in VFP
>>
>>But to get the exact position of parameters, becuase sometimes when you record a Macro Excel (Word) doesn't use all of them, beffer mark the Method used in Macro and press F1. That will invoke VBA Help and you will see the Exact syntax you could use in VFP. I just saw one error in my code:
>
>I'm afraid the VBA help is not stored on my PC, the boss is away and I don't know where the installation CD is and I can't find the approp. file on the network (install of Help failed and tried to find it but failed). So I'll have to "suck it and see". Thanks for the useful tips.
>
>>
>>#define xlNormal -4143
>>
>>oExcel.WorkBooks.Open([...........]) && I didn't use WorkBooks collection in my previuos code.
>>oExcel.ActiveWorkBook.SaveAs([Test.XLS],xlNormal)
>>
>>
>>To get all Excel (Word) predefined constants you could use:
>>Open Object Browser
>>Open XL5EN32.OLB (Program Files\MS Office\Office11\XL5EN32.OLB)
>>Open Constant Node of the TreeView
>>Open Empty file and Drag & Drop Constant node in it.
>
>I can't find these dirs/files on my PC, but I have a list of the VB constants which I found on the web while doing the previous work on automation.
>
>>
>>Other way is to put:
>>MsgBox xlNormal
>>
>>in Macro Editor and run it :-)
>
>This didn't work - got some error so abandoned doing what I didn't know. Besides, I don't know what you mean by this.
>
>Your servant
>
>Terry


If you want I could send you Help file for Excel, but it is better to install it.

If you can't find the value of some Excel constant you could Choose (in Excel not in VFP):
Tools->Macro->Macros->Create (after you put some bla-bla as name)
Then in Macro Editor write:
MsgBox xlNormal (or whatever constant you want to see value)
Press F5 :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform