从Excel超链接打开资源管理器搜索 [英] Open explorer search from excel hyperlink

查看:141
本文介绍了从Excel超链接打开资源管理器搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个项目上,我的当前目标是为excel编写一个脚本,该脚本将打开一个Windows资源管理器搜索到一个已经设置的位置,搜索单元格值.

I am working on a project, and my current goal is to write a script for excel that will open a windows explorer search to an already set location, searching for the cell value.

我认为使用shell最容易,但是我只是无法找到如何使用cmd中的命令来做到这一点.

I think this would be easiest with shell, but I just can't find out how to do this with a command in cmd.

我已经找到了很多东西(即使在确切的文件位置)也可以打开查找器和资源管理器,但是我无法将它们组合在一起以搜索要在确切位置中添加变量的文件.

I have found lots of stuff opening finder and explorer(even on the exact file location), but I just can't combine them to search for the file I would add in a variable in the exact location.

我在想这样的事情:

https://superuser.com/questions/499238/command-to-open-windows-explorer-window-with-filtered-results

例如,我想说的是,我在服务器上有一个位置,所有计算机备份都自动保存为备份名称< pcname + backup date> .我还有一个列出所有计算机名称的列表:

what I was trying to say is that, for example, I have a place on a server where all my computer backups automatically gets saved with the backup name <pcname+backup date>. I also have a list where all my computer names are listed:

asdpc-1

asdpc-2

asdpc-3

在我的excel列表中,这些都是超链接.我的目标是:当我单击asdpc-1时,它将在资源管理器中为我打开一个窗口,在搜索框中输入计算机名称,在服务器上搜索asdpc-1的备份.我发现这是最好的解决方案,因为备份的日期也包含在名称中.这样,我就可以看到为这台PC所做的所有备份.

In my excel list, those are made hyperlinks. My goal is: when I click on asdpc-1, it will open a window in explorer for me with the computer name in the search box, searching the server for asdpc-1's backup. I found this the best solution because of the date of the backup also gets included in the name. So this way I can see all the backups made for this pc.

我发现我有一些语法问题,并且现在已经修复,因此可以正常工作.

I figured it out that I had some syntax problems, and I fixed it by now, so it's working fine as expected.

推荐答案

好,我找到了答案,这只花了我3个小时:-)

ok I found the answer and it only took me 3 houres :-)

Shell("c:\Windows\explorer.exe ""search-ms:displayname=Search%20Results&crumb=System.Generic.String%3A" & <variable> & "&crumb=location:<your search location>%", vbNormalFocus)

要添加位置,最简单的就是按照您希望的方式手动进行搜索,而不是在位置:"之后复制文本.

to add location it is easyest to do the search manually just the way you want it to work, than copy the text after the "location:"

这篇关于从Excel超链接打开资源管理器搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆