将选择从chrome复制到excel

时间:2015-05-07 13:45:56

标签: vba google-chrome

我想在Chrome和Excel之间创建一种快速复制和粘贴方式。该程序需要执行粘贴给定单元格中的选择的任务。如果我们访问Excel它相当容易,我们只需要使用Microsoft Forms Library来获取我们复制到剪贴板的内容并将其粘贴到突出显示的字段中。我想扩展这个过程。现在看起来如下:

  1. 我在Chrome中复制了一些东西

  2. 我需要切换到Excel并访问宏以粘贴选中的内容

  3. 到目前为止我所拥有的:

     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
    

    是否可以跳过中间步骤并将Excel粘贴到剪贴板中而不必打开它?换句话说,我希望有一种方法可以在选择后自动粘贴剪贴板的内容。

0 个答案:

没有答案