Results 1 to 5 of 5

Force destination formatting

Threaded View

  1. #1
    Registered User
    Join Date
    05-13-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    6

    Question Force destination formatting

    Hi,
    sorry for this noob question but I'm searching thru the Internet and this forum for quite a while now..Without any results.. (Or I did not regarded them as results)

    Situation:
    I have a spread sheet in Excel 2010 where the user should copy and paste data from a IE window into.
    I wanted to have a Macro that automatically chooses "Match destination formatting" when CTRL+V is used to paste.

    The code:
    Sub mk_paste_destmatch()
    '
    ' mk_paste_destmatch Macro
    ' Always match destination formatting when pasting.
    '
    ' Keyboard Shortcut: Ctrl+V
    '
        ActiveSheet.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:= _
            False, NoHTMLFormatting:=True
    End Sub
    The problem:
    This works quite well when the user is actually pasting from the IE.
    BUT: If the user uses CTRL+V for any other paste (e.g. to paste a cell or anything) it produces a
    "Run-time-error 1004"
    "PasteSpecial method for Worksheet class has failed"

    I must admit that it goes beyond my skills to fix this...
    Any advice how to solve this problem would be highly regarded.

    Kind regards,
    Krumel
    Last edited by krumel; 05-13-2013 at 11:31 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1