VB程序中调用word
Option ExplicitDim ap As Word.Application, s As String, doc As DocumentPrivate Sub Command1_Click()Set ap = CreateObject("word.application")Set doc = ap.Documents.Open("d:\1.doc")s = doc.Content.TextPrint sEnd SubPrivate Sub Form_Unload(Cancel As Integer)doc.Closeap.QuitSet doc = NothingSet ap = NothingEnd Sub
怎么用vb编程操作word绘制表格的边框?
怎么用vb编程操作word绘制表格的边框操作步骤:1、单击开始----查找按钮(或按Ctrl + F组合键);2、弹出查找对话框,在查找内容处输入需要查找的数字,在以下项中查找处选择主文档,单击关闭按钮;3、此时文档中所的查找的数字都被选中。
如何用vb在word中输出文字
方法很简单,不需要使用shell函数,剪贴簿或是api也可以解决,要将 access 中的变数传到 word中,有两种方法(可能有很多吧!!但是我只知道这两种),第一是利用word内建的合并列印功能,另外一种是使用word中的"插入(i)/功能变数(F)"然后利用一个"DocVariable"功能变数,这样就可以轻松在VBA中对word文件中的指定的位置加入经程式处理过的文字....当然这两种方法,都需要程式设计者先设计一个word文件,使这个word文件一开启就具有已有己经事先安排好的合并列印栏位或是变数,让使用者只要在access中按下一个commandbutton就可以顺利看到自己所需的报表或是你所说的考卷出现在word中....
vb如何进行word页面设置的代码
'工程引用 Microsoft Word 12.o Objedt Library 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 '粗体.TypeText "这是一个VB编辑word的测试。
" '输出字符.Font.Bold = False.TopMargin = CentimetersToPoints(1.27) '页面上边距.BottomMargin = CentimetersToPoints(1.27) '页面下边距.LeftMargin = CentimetersToPoints(1.27) '页面左边距.RightMargin = CentimetersToPoints(1.27) '页面右边距End Withwd.Visible = Truewd.ShowMeSet wd = NothingEnd Sub
转载请注明出处51数据库 » vb word 编程