小编Joe*_*oeB的帖子

在打开的 Windows 资源管理器上选择一个文件

我有以下 cod,它将启动 Windows 资源管理器并选择一个文件并最大化资源管理器。然后它将查找 Windows 资源管理器并将其最小化。我做了最大化-最小化,这样我就不必手动执行此操作(懒惰,我知道)。我在我的代码中设置了此设置,仅在文件夹未打开时触发。如果它是打开的,那么只需运行最小化部分。这是代码:

If Not FolderIsOpen Then
    Dim curProcess As Process = New Process()
    With curProcess
        With .StartInfo
            .FileName = "explorer.exe"
            Dim MinimizeName As String = RegScoringWorkbookName.Replace(".xlsm", ".zip")
            .Arguments = String.Format("/select, ""{0}""", MinimizeName)
            .WindowStyle = ProcessWindowStyle.Maximized
        End With
        .Start()
    End With
    Thread.SpinWait(100000000)
    For Each IWindow As InternetExplorer In SHWindows
        If IWindow.Name = "Windows Explorer" Then
            Dim GetURIPath As New Uri(IWindow.LocationURL)
            If GetURIPath.LocalPath.ToLower.Equals(FolderName) Then
                ShowWindow(CType(IWindow.HWND, IntPtr), SW_SHOWMINIMIZED)
                Exit For
            End If
        End If
    Next IWindow
Else
    For Each …
Run Code Online (Sandbox Code Playgroud)

vb.net

4
推荐指数
1
解决办法
2629
查看次数

使工作簿可见

我有以下代码:

Dim DumpXlApp As Excel.Application = New Excel.Application
Dim DumpWkBk As Excel.Workbook
DumpWkBk = System.Runtime.InteropServices.Marshal.BindToMoniker(FilePath)
DumpXlApp = DumpWkBk.Parent
DumpXlApp.Visible = True
Run Code Online (Sandbox Code Playgroud)

我无法让DumpWkBk工作簿变得可见.是问题DumpXlApp = DumpWkBk.Parent线吗?我不认为这是BindToMoniker线,因为我可以用DumpWkBk做事.

vb.net excel office-automation

3
推荐指数
1
解决办法
2953
查看次数

标签 统计

vb.net ×2

excel ×1

office-automation ×1