
- Forum
- Testing
- Software Testing
- Add Bitmap Images to MS-Word doc using QTP
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 ...
-
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.
-
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

Reply With Quote





