如何将 Publisher 2010 表中所有行的行高设置为相同?(有答案!

How do I set the row height to be the same for all rows in a Publisher 2010 table? (With answer!)

提问人:Zytheran 提问时间:10/9/2023 最后编辑:Zytheran 更新时间:10/9/2023 访问量:5

问:

Publisher 2010 不允许用户使用任何按钮或菜单将表中的行高设置为特定高度。现在,您可能已将表格从Excel或Word粘贴到Publisher中,但由于某种原因调整了一行,然后您就被塞满了。您必须尝试关注行高以匹配其他行。Microsoft以其无限的智慧不允许其DTP程序这样做。 但是,Publisher 支持 VBA,它提供了一种解决方案,即通过一些 VBA 代码来创建宏。

我尝试寻找菜单项或按钮,但无济于事。然后我在网上查了一下,发现 Publisher 2010 不支持这个功能。

所以这是VBA中的解决方案。您需要将开发人员模式设置为打开,并将此代码输入到VBA模块中。

Sub AdjustTableRowSize()

    Dim rowSize As Long
    Dim inputStr As String
    Dim rowTable As Row
'a macro by NTD
' Dedicated to Angle Park Computer Centre, Adelaide , 1977, where I first learnt Basic using OCR cards! 
'Select table you want adjusted and then run this VBA Macro

    
    ' Loop until a valid input is received
    Do
        inputStr = InputBox("Please enter the table row height (between 6 and 72pt):", "Adjust Row Height")
        
        ' Exit the loop if the user cancels the InputBox
        If inputStr = "" Then Exit Sub
        
        ' Try to convert the input to a Long integer
        On Error Resume Next
        rowSize = CLng(inputStr)
        On Error GoTo 0
        
        ' Validate the row size
        If rowSize >= 6 And rowSize <= 72 Then
            Exit Do
        Else
            MsgBox "Invalid input. Please enter a number between 6 and 72.", vbExclamation
        End If
        
    Loop
    
    MsgBox "You entered a valid row size: " & rowSize, vbInformation
    With ActiveDocument.Pages(1).Shapes(1).Table
        For Each rowTable In .Rows
            rowTable.Height = rowSize
        Next
    End With
    
End Sub
发布者

评论


答: 暂无答案