VB关于word段落居中问题
'转到表格Public Sub GotoTheTable(ByVal ntable As Integer)Dim missing = System.Reflection.Missing.ValueDim what = Word.WdGoToItem.wdGoToTableDim which = Word.WdGoToDirection.wdGoToFirstDim count = ntableoWordApplic.Selection.GoTo(what, which, count, missing)oWordApplic.Selection.ClearFormatting()oWordApplic.Selection.Text = ""orange = oDocument.Tables(ntable).Cell(1, 1).Rangeorange.Select()End Sub
在VB中调用Word模板,Word模板包含表格,表格中有标签,我想调...
用word里面的邮件合并功能,首先:视图——工具栏——邮件合并,点出邮件合并工具栏,然后在工具栏上点击“打开数据源”,把你那个excel文件导入进来,把光标定位在姓名栏——插入域——姓名——插入——关闭,其他各科成绩也是定位在相应的科目,然后重复上面的工作,不同的是插入域不是“姓名”,而是相应各科成绩(例如:物理,数学……)。
全部插入完之后,查看合并数据,如果没有问题的话,就合并到新文档,把新文档打印出来就可以了。
Word中,运用宏批量设置当前文档中所有表格的单元格内容为水平居...
展开全部 我可以帮你实现word中所有表格水平居中垂直居中的效果,就用VBA代码来解决。
Su 水平垂直居中()Dim t As TableFor Each t In Me.Tables t.Select Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter Selection.Range.Cells.VerticalAlignment = wdCellAlignVerticalCenterNextEnd Sub...
vb 访问word 嵌套表格
Private Sub Command1_Click()Dim wd As New Word.Applicationwd.Documents.Add DocumentType:=wdNewBlankDocumentWith wd.Selection.Font.Spacing = 2.ParagraphFormat.Alignment = wdAlignParagraphCenter.Font.Size = 16.Font.Name = "宋体".Font.Bold = True.ParagraphFormat.LineSpacingRule = wdLineSpaceSingle.Font.Spacing = 0.TypeText label1.Caption.Font.Bold = False.TypeParagraph.ParagraphFormat.Alignment = wdAlignParagraphJustify.Font.Size = 10.TypeText text1.Text & text2.Textwd.ActiveDocument.Tables.Add Range:=wd.Selection.Range, NumRows:=mshflexgrid1.Rows, NumColumns _:=10, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=wdAutoFitFixedFor i = 1 To mshflexgrid1.RowsFor j = 1 To 10.Tables(1).Cell(i, j).Range.Text = mshflexgrid1.textmatrix(i - 1, j - 1)Next jNext i.EndKey Unit:=wdStory.Font.Color = wdColorRed.TypeText text3.Text & vbTab & vbTab & vbTab & text4.Text.TypeParagraph.Font.Color = wdColorAutomatic.TypeText text5.Text & vbTab & vbTab & vbTab & text6.TextEnd Withwd.Visible = Truewd.ShowMeSet wd = NothingEnd Sub
用VB如何从excel提取数据到word文档中
读写EXCEL表:展开全部1、在工程中引用Microsoft Excel类型库: 从"工程"菜单中选择"引用"栏;选择Microsoft Excel 12.0 Object Library(EXCEL2007),然后选择"确定"。
表示在工程中要引用EXCEL类型库。
2、在通用对象的声明过程中定义EXCEL对象: Dim xlApp As Excel.Application Dim xlBook As Excel.WorkBook Dim xlSheet As Excel.Worksheet 3、在程序中操作EXCEL表常用命令: Set xlApp = CreateObject("Excel.Application") '创建EXCEL对象 Set xlBook = xlApp.Workbooks.Open("文件名") '打开已经存在的EXCEL工件簿文件 Set xlBook = xlApp.Workbooks.Add("文件名") '创建新的EXCEL工件簿文件 xlApp.Visible = True '设置EXCEL对象可见(或不可见) Set xlSheet = xlBook.Worksheets("表名") '设置活动工作表 for i=1 to 100for j=1 to 50numArr(j,i)=xlSheet.Cells(j, i) '......................................nextnextxlBook.Close (True) '关闭工作簿 xlApp.Quit '结束EXCEL对象 Set xlApp = Nothing '释放xlApp对象张志晨...
转载请注明出处51数据库 » vb word表格居中