LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions,microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Hyperlinks.Delete without losing formatting?

I have javascript function that copies a table from a webpage to an
Excel worksheet. This is supposed to be a multi-purpose function that
works on various different tables, and sometimes the tables have
hyperlinks in them.

I have my script doing Hyperlinks.Delete(), and that strips all the
hyperlinks out of the sheet quite well. The problem is that when the
hyperlinks are removed, any formatting that existed in those cells is
removed as well. Borders, colors, font info, wrapping, number
formatting: all gone.

I tried doing this:

if (objExcelApp.Selection.Hyperlinks.Count 0){
for (i = objExcelApp.Selection.Hyperlinks.Count; i 0; i--){
LinkCell = objExcelApp.Selection.Hyperlinks(i).Parent;
NumFmt = LinkCell.NumberFormat;
IsBold = LinkCell.Font.Bold;
IsItalic = LinkCell.Font.Italic;
IsWrap = LinkCell.WrapText;
hAlign = LinkCell.HorizontalAlignment;
vAlign = LinkCell.VerticalAlignment;

LinkCell.Hyperlinks.Delete();

LinkCell.NumberFormat = NumFmt;
LinkCell.Font.Bold = IsBold;
LinkCell.Font.Italic = IsItalic;
LinkCell.WrapText = IsWrap;
LinkCell.HorizontalAlignment = hAlign;
LinkCell.VerticalAlignment = vAlign;
}
}

And it works. It doesn't do the borders, because I haven't done that
yet, but the basic concept works.

And it takes forever and a day.

So I was hoping that someone might know some arcane method of removing
hyperlinks *without* killing the formatting in the process.

Thanks,
Lisa
 
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
Losing hyperlinks, lock Save As so it cannot be saved in a lower format Hedstrom Excel Discussion (Misc queries) 0 July 26th 10 10:22 PM
Excel losing hyperlinks when I sort the worksheet Scott Bass Links and Linking in Excel 3 November 7th 08 09:40 AM
Losing hyperlinks RedChip Excel Discussion (Misc queries) 0 November 30th 05 10:56 AM
Copying HTML into Excel Losing Hyperlinks Davud Levitt Excel Discussion (Misc queries) 2 October 31st 05 01:02 AM
Delete without losing references? Ed[_9_] Excel Programming 2 July 9th 03 01:50 PM


All times are GMT +1. The time now is 09:38 PM.

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"