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:
01156089
Views:
31
Hi BB

I've had time to digest all this and try it out. Much improved. Strange. I record a macro as I alter the HTML file, within Excel, then run the macro on another identically formatted HTML file but get different results. This is getting too nebulous. I converted as much of the VB code to VFP and ran it against an HTML file, form my VFP prog, and got totally weird results. I've kind of given up the idea of automating this now, as my supervisor opines this will be a one-off situation, and in future the cust. will supply the data in XLS format (as he used to).

However, with regard to your poijntewrs below:
...
>** Put this so Intellisense to be activated
>LOCAL loExcel AS Excel.Application

Ah-ha! I've got this line in my form, for the previous autom. I was doing but had forgotten to put it in my test prog for this function. I'd no idea that the editor would react differently according to a var declaration. Yes Intellisense now operates.

>
>loExcel = CREATEOBJECT([Excel.Application])
>
>
>*** If you want to see what happens add this line
>loExcel.Visible = .t.

What I meant was, I wanted to see the result after all, and had visible = .t. at the end.

>
>Wait WINDOW "Opening HTML File ..." NOWAIT NOCLEAR
>loExcel.Workbooks.Open( "R:\OPDATA\Essex\SM_Coaches\APR06\sm coaches disk.htm")

Yes I had this already

>
>*** Turn of all warnings
>loExcel.DisplayAlerts = 0

Interesting

>
>**** Select and delete rows from one to 4
>loExcel.Range([1:4]).Delete(xlUp)
>
>**** Select and delete Column C
>loExcel.Range([C:C]).Delete(xlToLeft)

These are nice and succinct, rather than selecting then deleting the selection

>
>*** Save the file AFTER you made all changes
>loExcel.ActiveWorkBook.SaveAs("Test.XLS", xlNormal)

Had done this (I didn't include ALL my code)

>
>*** Close the file. You leave it opened, that is why you get that error message

Good point. This solves a problem with the other autom. task I did.

>*** If you call Task manager you will see several EXCELs running :-)

True, although it doesn't show in the Applications tab it does in the processes tab

>loExcel.ActiveWorkBook.Close()
>
>*** QUIT the Excel
>loExcel.Quit()

As I'd wanted the user to see the results of the conv. I'd ommitted this but, again, good point.

>
>loExcel = NULL
>RELEASE loExcel
>
>*** AND CLEAR WAIT WINDOW :-)))))))
>WAIT CLEAR

I had done this at the end of my code.


Thanks again, my friend.

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
Reply
Map
View

Click here to load this message in the networking platform