Created word doc and Save the word file

'*******************************************Function*********************************
'Author:-              Vishweshwar Reddy
'Function Name:-        fn_CreateWordDoc
'Function Description:- Creates and save the newly created word doc
'Input Parameters:-     Reporting folder Path
'Output Parameters:-    None
''***********************************************************************************
Dim objWordDoc
Public Function fn_CreateWordDoc(sReportingPath)
'Dim sReportingPath
'Creating the Microsoft Word object to capture ScreenShot
Set objWordDoc = Createobject("Word.Application")
'Making it visible for Testing purposes only
objWordDoc.visible = true
'Adding a new Blank document
objWordDoc.Documents.Add
'Selection method represents the current selected doc
Set objSelection = objWordDoc.Selection
'Saving the word doc file inside Screenshot folder
' msgbox sReportingPath
objWordDoc.ActiveDocument.SaveAs sReportingPath&Environment("TestName")&"_"&_
        Right("0" & Day(Date), 2) & Right("0" & Month(Date), 2) & Year(Date) & "_" & _
Right("0" & Hour(Now), 2) & Right("0" & Minute(Now), 2) & Right("0" & Second(Now), 2)
End Function

'*******************************************Function*********************************
'Author:-              Vishweshwar Reddy
'Function Name:-        fn_SaveWordDoc
'Function Description:- Save the Word Doc
'Input Parameters:-     None
'Output Parameters:-    None
''***********************************************************************************
Public Function fn_SaveWordDoc
objWordDoc.ActiveDocument.Save
objWordDoc.ActiveDocument.Close
objWordDoc.Quit
'Destroying the word object
Set objWordDoc = Nothing
Set objSelection = Nothing
End Function

Comments

Popular posts from this blog

UFT File Types and File Extensions

QTP/UFT Version History

Synchronization in UFT