1

I'd like to create a quick way of copying and pasting in between Chrome and Excel. The program would need to perform a task of pasting the selection in a given cell. If we access Excel it's fairly easy, we just need to use Microsoft Forms Library in order to get what we copied to clipboard and paste it in the highlighted field. I'd like to extend this process. Now it looks as follows:

  1. I copy something in Chrome

  2. I need to switch to Excel and access the macro in order to paste what's selected

What I have so far:

 Option Explicit

 Public Clipboard As New MSForms.DataObject

 Sub pasteTable1()
    'Tools -> References -> Microsoft Forms 2.0 Object Library
    'of you will get a "Compile error: user-defined type not defined"
      Dim DataObj As New MSForms.DataObject
      Dim S As String
      DataObj.GetFromClipboard
      S = DataObj.GetText
      Debug.Print S 'print code in the Intermediate box in the Macro editor
      ActiveSheet.Paste Destination:=Worksheets("Arkusz1").Range("A1")


End Sub

Would it be possible to skip the intermediate step and make Excel paste what's in the clipboard without having to open it? In other words I'd like to have a way of pasting the contents of clipboard automatically once the selection is made.

Pasato
  • 153
  • 9
  • What a bizarrely complex question in so many ways. My own thought process: A chrome extension running with ALLL the securities turned off listening on all webpages in manifest, set to listen for `onMouseUp`. The mouseup fires a loop: Check if there is text highlighted for `$('div').each, $('span').each` and so on on the active page/tab. If so, use the `chrome.fileSystem` to write this file to a temp uniquely named file in a folder. Have Excel with a timer checking this folder for changes, and pull out the file data and do something with it if there is. Anyone got a better hacky solution? – TechnicalChaos May 07 '15 at 17:40
  • Ah I thought you meant as soon as a selection is made. If you meant as soon as copy is done, you could replace the onMouseUp with the info in this [answer](http://stackoverflow.com/questions/3436102/copy-to-clipboard-in-chrome-extension) – TechnicalChaos May 07 '15 at 17:45

0 Answers0