Solved

How to modify vba code to not highlight text in red when pasting?

Posted on 2014-12-03
2
163 Views
Last Modified: 2014-12-03
The below code pastes text from the clipboard that is copied from IE, but it changes the font color to red.  I need to modify it so that the font color is black.

Sub Paste_Journal()
    On Error Resume Next
      With GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
      .GetFromClipboard
      Range("A3").Value = .GetText
   End With

End Sub

Open in new window

0
Comment
Question by:kbay808
2 Comments
 
LVL 15

Accepted Solution

by:
gplana earned 500 total points
ID: 40478985
Try to add this line just before the EndWith:

Range("A3").Font.Color = RGB( 0, 0 , 0 )

So your code should be:
Sub Paste_Journal()
    On Error Resume Next
      With GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
      .GetFromClipboard
      Range("A3").Value = .GetText
      Range("A3").Font.Color = RGB(0,0,0)
   End With

End Sub

Open in new window

0
 

Author Closing Comment

by:kbay808
ID: 40479002
That worked perfectly.  Thanks
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question