Exforsys
+ Reply to Thread
Results 1 to 2 of 2

Add Bitmap Images to MS-Word doc using QTP

This is a discussion on Add Bitmap Images to MS-Word doc using QTP within the Software Testing forums, part of the Testing category; Given a set of bitmap files. I want to know How to add the bitmap files to Microsoft Word file ...

  1. #1
    Guptha_S is offline Member Array
    Join Date
    Jan 2006
    Answers
    46

    Add Bitmap Images to MS-Word doc using QTP

    Given a set of bitmap files.
    I want to know How to add the bitmap files to Microsoft Word file via QTP.


  2. #2
    lokeshm is offline Member Array
    Join Date
    Apr 2005
    Answers
    83
    You can use vbscript to do this as

    Dim MSWordObj, Doc, currentDocument
    Doc = "C:\TestImg.docx"

    Set MSWordObj = CreateObject("Word.Application")

    MSWordObj.DisplayAlerts = 0
    MSWordObj.Documents.Open Doc

    Set currentDocument = MSWordObj.Documents(1)

    Set image_document = MSWordObj.Documents.Add()
    Set image_doc_selection = MSWordObj.Selection
    Set image_doc_range = image_document.Range()
    Set image_doc_shape = image_document.inlineShapes

    image_doc_shape.AddPicture("c:\image.bmp")

    currentDocument.Close
    Set currentDocument = Nothing
    MSWordObj.Quit
    Set MSWordObj = Nothing


Latest Article

Network Security Risk Assessment and Measurement

Read More...