【问题标题】:Open second excel workbook in other screen(monitor) VBA在其他屏幕(监视器)VBA 中打开第二个 excel 工作簿
【发布时间】:2018-09-27 08:55:18
【问题描述】:

我有两台显示器。在右边我有我的第一个宏工作簿。我将如何使用位于第一个工作簿中的宏(VBA)打开左侧的第二个工作簿。谢了

【问题讨论】:

    标签: excel vba monitor


    【解决方案1】:

    如果您只自己使用这个文件并且总是在同一个配置中,您可以使用一些快捷方式。
    left 用于主监视器 = 0。如果辅助监视器位于主监视器的左侧,则 left 将是某个数字 次要在右侧,然后left 标记辅助监视器的开始将是left + width 的 Excel 窗口(如果它已最大化)。
    假设辅助显示器在左侧
    这应该很好用

    Option Explicit
    
    Public Sub NewWbk()
        Dim Exl As Excel.Application
    
        Set Exl = New Excel.Application 
        'here you'll need to change to open your file instead of adding new empty file 
        Exl.Workbooks.Add 
        Exl.Visible = True
        With Exl.Application
            .WindowState = xlNormal 'can't move maximized window 
            .Left = -500 'should work on most resolutions
            .WindowState = xlMaximized
        End With
    
    End Sub
    

    但这是非常不可靠的解决方案,在许多情况下可能无法正常工作。 您应该做的是使用 API 调用、检查监视器数量、检查您的应用在哪个监视器上可见并决定在哪里打开新文件。
    看看Here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-04
      • 2019-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-17
      • 2018-12-29
      • 1970-01-01
      相关资源
      最近更新 更多