1、 0 Then 如果 Word 没有运行则 Set Wrd = CreateObject(运行它 End If Err.Clear 清除发生错误的 Err 对象 On Error GoTo 0 保留普通错误进程 Dim dot As String Dim doc As String Wrd.Visible =true dot = C:temp.dotdoc = c:temp.docDocuments.Open FileName:=dot, _ ConfirmConversions:=False, ReadOnly:=True, AddToRecentFiles:=False, _ Passwo
2、rdDocument:=, PasswordTemplate:, Revert:WritePasswordDocument:, WritePasswordTemplate:, Format:= _ 0 Wrd.ActiveDocument.Close Wrd.Documents.Add Template:=dot, NewTemplate:=False 结果系列操作 ActiveDocument.SaveAs FileName:=doc, FileFormat:=wdFormatDocument, _ LockComments:=False, Password:, AddToRecentFil
3、es:=True, WritePassword _ :, ReadOnlyRecommended:=False, EmbedTrueTypeFonts:SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:False 打印出来 ActiveDocument.PrintOut FileName:=doc, Range:=wdPrintAllDocument, Item:wdPrintDocumentContent, Copies:=1, Pages:, PageType:=wdPrintAllPages, _
4、 ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _ PrintZoomPaperHeight:=0 WORD中打字 Selection.TypeText Text:您好,先生如何让Word的保存命令调用我自己编写的保存方法?在doc文档被修改以后,在退出的时候当提示用户文档已经修改,问是否保存 和直接点击保存按钮的时候,能否让Word去调用我自己编写的SaveDoc
5、方法, 如何实现?创建名为“FileSave”的宏,把你的代码写入在这个宏中。当点击“保存”按钮或退出程序要求“保存”时,都会直接执行你的“FileSave”宏,而不再执行Word的内置命令。怎么样判断Word文档中有没有图片?Word里的图片包括两种(据我所知),楼上的漏掉了InlineShapes If ActiveDocument.Shapes.Count + ActiveDocument.InlineShapes.Count 0 Then MsgBox esitElse Document doesnt contain a shapeQQ:怎样在程序中把图片写入到中。AA:功能是:在指定
6、位置插入图片并设置图片的格式(包括设置为衬托于文字下方) Sub 设置图片格式() Selection.InlineShapes.AddPicture FileName:D:Mypicture800x600.jpg, _ LinkToFile:=False, SaveWithDocument:=True Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend Selection.InlineShapes(1).ConvertToShape.Select Selection.ShapeRange.Fill.Visible
7、= msoFalse Selection.ShapeRange.Fill.Transparency = 0# Selection.ShapeRange.Line.Weight = 0.75 Selection.ShapeRange.Line.DashStyle = msoLineSolid Selection.ShapeRange.Line.Style = msoLineSingle Selection.ShapeRange.Line.Transparency = 0# Selection.ShapeRange.Line.Visible = msoFalse Selection.ShapeRa
8、nge.LockAspectRatio = msoTrue Selection.ShapeRange.Height = 361.4 Selection.ShapeRange.Width = 481.6 Selection.ShapeRange.PictureFormat.Brightness = 0.5 Selection.ShapeRange.PictureFormat.Contrast = 0.5 Selection.ShapeRange.PictureFormat.ColorType = msoPictureAutomatic Selection.ShapeRange.PictureFo
9、rmat.CropLeft = 0# Selection.ShapeRange.PictureFormat.CropRight = 0# Selection.ShapeRange.PictureFormat.CropTop = 0# Selection.ShapeRange.PictureFormat.CropBottom = 0# Selection.ShapeRange.RelativeHorizontalPosition = _ wdRelativeHorizontalPositionColumn Selection.ShapeRange.RelativeVerticalPosition
10、 = _ wdRelativeVerticalPositionPage Selection.ShapeRange.Left = wdShapeCenter Selection.ShapeRange.Top = wdShapeCenter Selection.ShapeRange.LockAnchor = False Selection.ShapeRange.WrapFormat.AllowOverlap = True Selection.ShapeRange.WrapFormat.Side = wdWrapBoth Selection.ShapeRange.WrapFormat.Distanc
11、eTop = CentimetersToPoints(0) Selection.ShapeRange.WrapFormat.DistanceBottom = CentimetersToPoints(0) Selection.ShapeRange.WrapFormat.DistanceLeft = CentimetersToPoints(0.32) Selection.ShapeRange.WrapFormat.DistanceRight = CentimetersToPoints(0.32) Selection.ShapeRange.WrapFormat.Type = 3 实际上真正有用的是下
12、面的语句设置图片为衬托于文字下方 Selection.ShapeRange.ZOrder msoSendBehindText End Sub 有没有方法,把一个word文件,按编号返回一段一段的段落文章。比如 1 XXXX 1.1 YYYY 1.1.1 ZZZZ QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ 1.1.2 SSSS PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 能够返回 一个编号对应的一个标题和一段话。谢谢 加载Microsoft Word 9.0 Object Library Dim dcApp As Word.Application
13、 Dim dcWd As Word.Document Private Sub Form_Load() Set dcApp = New Word.Application Set dcWd = dcApp.Documents.Open(rpt.doc) For i = 1 To dcWd.Paragraphs.Count Debug.Print dcWd.Paragraphs(i).Range.Text Next dcWd.Close Set dcWd = Nothing dcApp.Quit Set dcApp = Nothing 如何用vb实现在word的bookmark后插入字符 在word模版中指定了boolmark:a, Dim wrdapp As Word.Application Dim wrddoc As Word.Document Dim strFileName As String Dim i As Variant dim s as string s=要插入的字符Set wrdapp = CreateObject(strFileName = App.Path & Set wrddoc = wrda
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1