Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
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…

840 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