有没有办法可以将电子表格显示为没有工具栏的小窗口?

有没有办法可以将电子表格显示为没有工具栏的小窗口?

我的屏幕上堆满了东西,仍然需要添加一个小的电子表格,大概一英寸高,不到一英寸宽。有什么解决办法吗?我不做复杂的计算,只是一些简单的数学运算,但需要这个窗口始终位于顶部。

答案1

这是瞎猜,我运行的是 64 位 Win 7,但是尝试

Declare Function SetWindowPos Lib "user32" _   (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _   ByVal X As Long, ByVal Y As Long, ByVal cx As Long, _   ByVal cy As Long, ByVal uFlags As Long) As Long

Private Declare Function FindWindow Lib "user32" _
    Alias "FindWindowA" (ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long

Const HWND_TOPMOST = -1 Const HWND_NOTOPMOST = -2

Sub AlwaysOnTop()

  Dim hwnd As Long   Dim res As Long

  hwnd = FindWindow("XLMAIN", vbNullString)   res = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, vbNull)

End Sub

Sub NotAlwaysOnTop()

  Dim hwnd As Long   Dim res As Long

  hwnd = FindWindow("XLMAIN", vbNullString)   res = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, vbNull)

End Sub

将其放入 VBA,然后运行 ​​alwaysontop 宏。查看它是否保持在最上面。对我来说没用,即使我将其转换为 64 位。

答案2

Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, _
                                                   ByVal hWndInsertAfter As Long, _
                                                   ByVal X As Long, _
                                                   ByVal Y As Long, _
                                                   ByVal cx As Long, _
                                                   ByVal cy As Long, _
                                                   ByVal wFlags As Long) As Long

Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, _
                                                 ByVal nCmdShow As Long) As Long


Public Function ResizeAccess()
  Dim lngReturn As Long
  Dim hWnd As Long

  ' get app's window handle
  hWnd = Application.hWndAccessApp

  ' move to upper left vorner of screen 0, 0
  ' resize app window to 800 x 600
  lngReturn = SetWindowPos(hWnd, 0, 0, 0, 800, 600, 0)

  ' normalize window
  lngReturn = ShowWindow(hWnd, 1)
End Function

相关内容