Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用VBScript和word文档将表格中的单元格文本垂直居中?_Vbscript - Fatal编程技术网

如何使用VBScript和word文档将表格中的单元格文本垂直居中?

如何使用VBScript和word文档将表格中的单元格文本垂直居中?,vbscript,Vbscript,我试着用 With myTable.Rows(1) .Height = 20 .Cells.VerticalAlignment = wdAlignVerticalTop End With 但它似乎不适用于VBScript,有人知道如何做我想做的事情吗 如果使用vbscript,则vbscript不知道word枚举常量的值。因此,要么为这些常量赋值,要么直接使用数字/常量,如下所示: With myTable.Rows(1) .Height = 20 .Cells.Vertic

我试着用

With myTable.Rows(1) 
 .Height = 20 
 .Cells.VerticalAlignment = wdAlignVerticalTop 
End With

但它似乎不适用于VBScript,有人知道如何做我想做的事情吗

如果使用vbscript,则vbscript不知道word枚举常量的值。因此,要么为这些常量赋值,要么直接使用数字/常量,如下所示:

With myTable.Rows(1) 
 .Height = 20 
 .Cells.VerticalAlignment = 1              '1 means WdCellVerticalAlignment(see link below)
End With
单击此处--


此外,如果您使用的是单词VBA而不是vbscript,则应提及正确的枚举常量。在您的情况下,它不应该是
wdAlignVerticalTop
。相反,它应该是
WdCellVerticalAlignment

如果您使用的是vbscript,则vbscript不知道word枚举常量的值。因此,要么为这些常量赋值,要么直接使用数字/常量,如下所示:

With myTable.Rows(1) 
 .Height = 20 
 .Cells.VerticalAlignment = 1              '1 means WdCellVerticalAlignment(see link below)
End With
单击此处--


此外,如果您使用的是单词VBA而不是vbscript,则应提及正确的枚举常量。在您的情况下,它不应该是
wdAlignVerticalTop
。相反,它应该是
WdCellVerticalAlignment

很高兴我能帮忙:)很高兴我能帮忙:)