Excel的复制和粘贴在Windowssearch

我正在使用Excel 2010和Windows 7专业版。 我想将一个单元格内容复制到Windowssearch框中。 我如何为此编写一个VBA?

Sub CopytoSearchWindow() 'CopytoSearchWindow Macro ' ' sCell = Range(Application.InputBox(Prompt:="Pick the Cell", Type:=8)).Value 

Solutions Collecting From Web of "Excel的复制和粘贴在Windowssearch"

您可以使用Shell.Application对象与发送一些关键笔划一起执行此操作。

例如:(用你喜欢的任何东西替换我的searchString位)

 Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Sub searchExample() Dim searchCell As Range Dim shellApp As Object Dim wshShell As Object On Error Resume Next 'to catch if user presses cancel Set searchCell = Application.InputBox(Prompt:="Pick the Cell", Type:=8) On Error Goto 0 If searchCell Is Nothing Then Exit Sub Set shellApp = CreateObject("Shell.Application") Set wshShell = CreateObject("WScript.Shell") shellApp.FindFiles Sleep 500 wshShell.SendKeys searchCell.Value & "{enter}" End Sub 

Shell.Application参考: http : //msdn.microsoft.com/en-us/library/windows/desktop/bb773938%28v=vs.85%29.aspx

Windows脚本主机Shell参考: http : //msdn.microsoft.com/en-us/library/aew9yb99%28v=vs.84%29.aspx