Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-15-2013, 10:14 AM
desm0nd desm0nd is offline Trying to paste a link and merge formatting Windows 7 64bit Trying to paste a link and merge formatting Office 2010 64bit
Novice
Trying to paste a link and merge formatting
 
Join Date: Apr 2013
Posts: 2
desm0nd is on a distinguished road
Default 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>
Reply With Quote
  #2  
Old 04-15-2013, 11:28 PM
macropod's Avatar
macropod macropod is offline Trying to paste a link and merge formatting Windows 7 64bit Trying to paste a link and merge formatting Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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
The above macro has broader application than your html coding, being useful for any unformatted text pasting. Simply assign it to a keyboard shortcut.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 04-22-2013, 09:40 AM
desm0nd desm0nd is offline Trying to paste a link and merge formatting Windows 7 64bit Trying to paste a link and merge formatting Office 2010 64bit
Novice
Trying to paste a link and merge formatting
 
Join Date: Apr 2013
Posts: 2
desm0nd is on a distinguished road
Default

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?
Reply With Quote
  #4  
Old 04-22-2013, 03:43 PM
macropod's Avatar
macropod macropod is offline Trying to paste a link and merge formatting Windows 7 64bit Trying to paste a link and merge formatting Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to paste a link and merge formatting Paste Special: Copy and Paste Formatting Only? tinfanide Word 6 03-06-2013 12:21 AM
Trying to paste a link and merge formatting Paste formatting LarryStroup PowerPoint 1 12-11-2012 12:10 AM
Trying to paste a link and merge formatting 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
Trying to paste a link and merge formatting Paste Excel Link As tphillippe PowerPoint 1 11-26-2009 05:54 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:26 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft