Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting pasted HTML controls with Javascript

Okay, this is an odd problem. I have an export function that copies a
table from HTML and pastes it into an Excel spreadsheet. The problem
is, the table has checkboxes in it, so when I paste, I get shapes in
the spreadsheet. And I want to delete them from the same webpage that
I used to copy the HTML over.

I can run a macro in Excel that says:

For i = ActiveSheet.Shapes.Count To 1 Step -1
ActiveSheet.Shapes(i).Delete
Next i

This works fine. But when I try and do it from Excel, it crashes and
burns:

for (i = objWorksheet.Shapes.Count; i = 1; i--){
objWorksheet.Shapes(i).Delete;
}

If I do alert(objWorksheet.Shapes(i).Name), it gives me the name of
each object, so I know I'm accessing the objects. I can even set an
object equal to the shape, but when I try and do .Delete, it craps
out.

Has anyone run into something like this? I don't know if it's some
sort of wonky Microsoft security thing, or if someone simply forgot to
include this method when they made the COM wrapper, but it's driving
me nuts. There must be some way to get rid of those things from the
javascript, no?

Thanks in advance,
Lisa
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Deleting pasted HTML controls with Javascript

Some things not clear:

1. Where is your export function running? How is the HTML copied to XL ?
2. You say "from Excel" but then show javascript code - where is this
running ? Did you mean from outside of XL ?

Maybe:

objWorksheet.Shapes(i).Delete(); // in loop

or just

objWorksheet.Shapes.Delete() //without the loop


Tim

wrote in message
...
Okay, this is an odd problem. I have an export function that copies a
table from HTML and pastes it into an Excel spreadsheet. The problem
is, the table has checkboxes in it, so when I paste, I get shapes in
the spreadsheet. And I want to delete them from the same webpage that
I used to copy the HTML over.

I can run a macro in Excel that says:

For i = ActiveSheet.Shapes.Count To 1 Step -1
ActiveSheet.Shapes(i).Delete
Next i

This works fine. But when I try and do it from Excel, it crashes and
burns:

for (i = objWorksheet.Shapes.Count; i = 1; i--){
objWorksheet.Shapes(i).Delete;
}

If I do alert(objWorksheet.Shapes(i).Name), it gives me the name of
each object, so I know I'm accessing the objects. I can even set an
object equal to the shape, but when I try and do .Delete, it craps
out.

Has anyone run into something like this? I don't know if it's some
sort of wonky Microsoft security thing, or if someone simply forgot to
include this method when they made the COM wrapper, but it's driving
me nuts. There must be some way to get rid of those things from the
javascript, no?

Thanks in advance,
Lisa



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling VBA code from html or javascript Brent E Excel Discussion (Misc queries) 0 October 16th 08 11:27 PM
FREE Tutorials on HTML XHTML CSS JavaScript XML XSL ASP SQL ADOVBScript, SAP - ABAP Dhanabal Excel Discussion (Misc queries) 0 May 24th 08 04:36 AM
FREE Tutorials on HTML XHTML CSS JavaScript XML XSL ASP SQL ADOVBScript, SAP - ABAP Dhanabal Excel Discussion (Misc queries) 0 May 23rd 08 12:10 PM
pasted HTML text disappears sunslight Excel Discussion (Misc queries) 2 January 9th 07 06:50 AM
HTML Table pasted to Excel Josh O. Excel Discussion (Misc queries) 2 October 19th 05 06:52 PM


All times are GMT +1. The time now is 12:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"