在vb中,怎样把图片写入到word中,同时还有文字。

解决方案 »

  1.   

    转载
    功能是:在指定位置插入图片并设置图片的格式(包括设置为衬托于文字下    方)
    Sub 设置图片格式()
        Selection.InlineShapes.AddPicture FileName:="D:\Mypicture\800x600.jpg", _
            LinkToFile:=False, SaveWithDocument:=True
        Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
        Selection.InlineShapes(1).ConvertToShape.Select
        Selection.ShapeRange.Fill.Visible = 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.ShapeRange.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.PictureFormat.CropLeft = 0#
        Selection.ShapeRange.PictureFormat.CropRight = 0#
        Selection.ShapeRange.PictureFormat.CropTop = 0#
        Selection.ShapeRange.PictureFormat.CropBottom = 0#
        Selection.ShapeRange.RelativeHorizontalPosition = _
            wdRelativeHorizontalPositionColumn
        Selection.ShapeRange.RelativeVerticalPosition = _
            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.DistanceTop = 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
    ‘实际上真正有用的是下面的语句设置图片为衬托于文字下方
        Selection.ShapeRange.ZOrder msoSendBehindText
    End Sub
      

  2.   

    学习ing
    怎样来定位呢?
    比如说我想在文档的第三行、第三列加入图片,该如何处理?