Olá Marco!
Isto só com VBA. Eu pesquisei em fóruns internacionais e achei uma postagem com um código que funcionou. (https://www.mrexcel.com/forum/excel-questions/426463-disabling-excel-application-resizing.html).
O código que funciona e trava a janela do Excel na posição e tamanho é o que está abaixo e deve ser inserido no módulo da pasta de trabalho:
Option Explicit
Private Type POINTAPI
X As Long
Y As Long
End Type
#If VBA7 Then
Private Type MSG
hwnd As LongPtr
message As Long
wParam As LongPtr
lParam As LongPtr
time As Long
pt As POINTAPI
End Type
Private Declare PtrSafe Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, ByVal lParam As LongPtr) As Long
Private Declare PtrSafe Function GetMessage Lib "user32" Alias "GetMessageA" (lpMsg As MSG, ByVal hwnd As LongPtr, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As Long
#Else
Private Type MSG
hwnd As Long
message As Long
wParam As Long
lParam As Long
time As Long
pt As POINTAPI
End Type
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function GetMessage Lib "user32" Alias "GetMessageA" (lpMsg As MSG, ByVal hwnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As Long
#End If
Private bCancel As Boolean
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const WM_NCLBUTTONDBLCLK = &HA3
Public Sub Prevent_Resizing_Excel()
Dim tMSG As MSG
bCancel = False
Do While GetMessage(tMSG, 0, 0, 0)
If bCancel Then Exit Do
With tMSG
If .message <> WM_NCLBUTTONDOWN And .message <> WM_NCLBUTTONDBLCLK Then
DoEvents
PostMessage .hwnd, .message, .wParam, .lParam
End If
End With
DoEvents
Loop
End Sub
Public Sub Restore_Resizing_Excel()
bCancel = True
End Sub
Private Sub Workbook_Open()
'=================================================================================
'Any exixting code goes here before calling the 'Restore_Resizing_Excel' routine
'=================================================================================
Call Prevent_Resizing_Excel
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call Restore_Resizing_Excel
End Sub
Não sei se é a melhor maneira de fazer isso. Se não achar a solução adequada, sugiro postar a dúvida no fórum do MSDN na categoria de VBA:
https://social.msdn.microsoft.com/Forums/pt-BR/home?forum=vbapt
Abraços!