欢迎来到天天文库
浏览记录
ID:41286250
大小:33.51 KB
页数:3页
时间:2019-08-21
《用vb在Word文档中插入和导出图片对象》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、2、在Word文档中插入和导出图片对象[vb] viewplaincopy1.'先引用Microsoft Word 11.0 Object Library 2.Option Explicit 3. 4.Dim WordApp As Word.Application '创建Word应用程序 5. 6.Private Sub Command1_Click() 7. On Error GoTo Errhandler 8. CommonDialog1.Filter = "Word(*.Doc)
2、*.Doc
3、AllFile(*.*)
4、*.*" 9. CommonD
5、ialog1.FilterIndex = 1 10. CommonDialog1.ShowOpen 11. Set WordApp = New Word.Application '实例化 12. WordApp.Documents.Open CommonDialog1.FileName '打开Word文件 13. WordApp.Visible = True '显示 Office Word 界面 14. '或者Application.Visible = True 15. WordApp.DisplayAlerts = False '不提示保
6、存对话框 16. WordApp.Selection.EndKey Unit:=wdStory '将光标移到文档末尾,在文本后面插入图片对象 17. Selection.TypeText Text:="我的图片" '图片的标题名称 18. 19. '插入图片对象 20. Selection.InlineShapes.AddPicture FileName:="C:CommandPicture.jpg", LinkToFile:=False, SaveWithDocument:=True 21. Selection.MoveLeft U
7、nit:=wdCharacter, Count:=1, Extend:=wdExtend 22. Selection.InlineShapes(1).ConvertToShape.Select 23. Selection.ShapeRange.Fill.Visible = msoFalse 24. Selection.ShapeRange.Fill.Transparency = 0# 25. Selection.ShapeRange.Line.Weight = 0.75 26. Selection.ShapeRange.Line.DashStyle
8、 = msoLineSolid 27. Selection.ShapeRange.Line.Style = msoLineSingle 28. Selection.ShapeRange.Line.Transparency = 0# 29. Selection.ShapeRange.Line.Visible = msoFalse 30. Selection.ShapeRange.LockAspectRatio = msoTrue 31. Selection.ShapeRange.Height = 361.4 32. Selection.Sha
9、peRange.Width = 481.6 33. Selection.ShapeRange.PictureFormat.Brightness = 0.5 34. Selection.ShapeRange.PictureFormat.Contrast = 0.5 35. Selection.ShapeRange.PictureFormat.ColorType = msoPictureAutomatic 36. Selection.ShapeRange.PictureFormat.CropLeft = 0# 37. Selection.ShapeRa
10、nge.PictureFormat.CropRight = 0# 38. Selection.ShapeRange.PictureFormat.CropTop = 0# 39. Selection.ShapeRange.PictureFormat.CropBottom = 0# 40. Selection.ShapeRange.RelativeHorizontalPosition = wdRelativeHo
此文档下载收益归作者所有