Solved

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

Posted on 2014-12-03
2
160 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now