VB在Excel中搜索字符串并将返回的偏移单元格值转换为另一个字符串

时间:2015-08-04 14:22:51

标签: vb.net

我开始提出一个新问题,因为很难在评论部分显示代码更新。

下面是我的不完整代码,我需要在DDDL工作簿中找到wd_full,如下所示,向右移动1个单元格,然后将该值返回到找到的字符串

我已经“评论”过的那篇文章是我用来查找文件夹的旧方法,耗时太长。 DDDL电子表格有2列,列a是设计参考,列是文件夹路径。

Private Sub GoBut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoBut.Click

    Dim wdcode As String
    wdcode = TextCode.Text
    Dim wd_wild As String
    wd_wild = "*"
    Dim wd_full As String
    wd_full = wd_wild & wdcode
    Dim found As String
    Dim DDDL As String
    DDDL = "N:\IT\Database\Design Drive Dir List\DDDL.xlsx"

    Dim exApp As Microsoft.Office.Interop.Excel.Application
    exApp = CreateObject("Excel.Application")

    exApp.Visible = True
    exApp.Workbooks.Open(DDDL)

    found = Find(wd_full).Offset(0, 1).Value()


    exApp.Quit()

    ' found = My.Computer.FileSystem.GetDirectories("Y:\Sample Code Sequence\", FileIO.SearchOption.SearchAllSubDirectories, wd_full).FirstOrDefault()

    MsgBox(wd_full, MsgBoxStyle.OkOnly, "Found Directory")

    Process.Start("explorer.exe", String.Format("/n, /e, {0}", found))
End Sub

0 个答案:

没有答案