?
Solved

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

Posted on 2014-12-03
2
Medium Priority
?
169 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
gplana earned 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

770 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