我在VBA中有一个用户表单,高度为515,宽度为975。 这是我用来打印它的代码。
Private Sub CommandButton4_Click()
Questionaire1.PrintForm
End Sub
此代码运行完美,当我单击按钮打印表单时,它为我提供了以pdf格式保存表单的选项,但此代码只打印了一个较小的表单部分,而我想打印整个表单。
答案 0 :(得分:0)
试试这段代码: 首先声明此代码:
std::vector<int> arr;
AddToArray(node, arr);
void AddToArray(Node *node, std::vector<int>& arr) {
if (node == NULL)
return;
arr.push_back(maxRes(score)); // what score?
}
编辑:或者,如果您有错误,请声明(x32系统):
Option Explicit
Private Declare PtrSafe Sub keybd_event Lib "user32" _
(ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As LongPtr)
Const VK_SNAPSHOT = 44
Const VK_LMENU = 164
Const KEYEVENTF_KEYUP = 2
Const KEYEVENTF_EXTENDEDKEY = 1
并将其放在按钮代码中:
Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Const VK_SNAPSHOT = 44
Public Const VK_LMENU = 164
Public Const KEYEVENTF_KEYUP = 2
Public Const KEYEVENTF_EXTENDEDKEY = 1
这对我有用。 资料来源:https://www.excelbanter.com/excel-programming/418448-print-userform-fit-one-page.html