#1
|
|||
|
|||
Trying to paste a link and merge formatting
Hello,
I am trying to edit HTML code in Word.. When I try to paste a link, into a spot that already has a link, it gives me extra spaces I don't want.. Need help trying to eliminate this problem.. <td class="price" width="72" valign="top" style="color:#37b7cd; font-size:22px; font-family:Arial, Helvetica, sans-serif; font-weight:bold;"><a href="http://www.test.com/xxx/xxx/xxx/xxx/xxx" target="_blank" style="color:#0a749c;">$695</a><br> When I try to replace http://www.test.com/ with http://www.anothertest.com/rrr/rrr/ , I get a space before the link and right after it.. How do I just replace the links without any spaces.. <td class="price" width="72" valign="top" style="color:#37b7cd; font-size:22px; font-family:Arial, Helvetica, sans-serif; font-weight:bold;"><a href=" http://www.anothertest.com/rrr/rrr/ xxx/xxx/xxx/xxx/xxx" target="_blank" style="color:#0a749c;">$695</a><br> |
#2
|
||||
|
||||
Try making your copy/paste start with the period (i.e omit http://www). If the paste starts with the period, you won't get the unwanted space. Similarly, if the copied string terminates in a '/', a trailing space isn't inserted.
An alternative would be to use a macro: Code:
Private Sub PasteUnformattedText() Dim MyData As DataObject On Error GoTo ErrExit Set MyData = New DataObject MyData.GetFromClipboard Selection.Range.Text = MyData.GetText ErrExit: End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
I tried your first suggestion and that didn't solve it.. I am not sure how to use a macro?
Its weird because sometimes when I copy and paste a link, it will not do the extra space, while sometimes it will.. Any other suggestions? |
#4
|
||||
|
||||
For macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm
The variable responses to copy/paste are due to Word trying to interpret how the content should appear in a normal document, not how it might be used for HTML coding. Word is, after all, a word processor, not an HTML coding package.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Paste Special: Copy and Paste Formatting Only? | tinfanide | Word | 6 | 03-06-2013 12:21 AM |
Paste formatting | LarryStroup | PowerPoint | 1 | 12-11-2012 12:10 AM |
Link and Keep Source Formatting--not exact | minny | Excel | 2 | 04-09-2012 04:19 PM |
Paste Special Link no longer working | MrsMoe | PowerPoint | 0 | 12-20-2010 10:54 PM |
Paste Excel Link As | tphillippe | PowerPoint | 1 | 11-26-2009 05:54 PM |