When message box is not sufficient!!




There are instances when we want to output a large amount of text and we can see just the truncated version in a msgbox. Here is a quick function that can be reused:

Sub Debug2(myText)
  ' Uncomment the next line to turn off debugging
  ' Exit Sub

  If Not IsObject(objIEDebugWindow) Then
    Set objIEDebugWindow = CreateObject("InternetExplorer.Application")
    objIEDebugWindow.Navigate "about:blank"
    objIEDebugWindow.Visible = True
    objIEDebugWindow.Toolbar = False
    objIEDebugWindow.Width = 200
    objIEDebugWindow.Height = 300
    objIEDebugWindow.Left = 10
    objIEDebugWindow.Top = 10
    Do While objIEDebugWindow.Busy
      WScript.Sleep 100
    Loop
    objIEDebugWindow.Document.Title = "IE Debug Window"
    objIEDebugWindow.Document.Body.InnerHTML = _
                 "" & Now & "
"
  End If

  objIEDebugWindow.Document.Body.InnerHTML = _
                   objIEDebugWindow.Document.Body.InnerHTML _
                   & myText & "
" & vbCrLf
End Sub

Comments

  1. Wonderful blog & good post.Its really helpful for me, awaiting for more new post. Keep Blogging!



    Software Testing Services Company

    ReplyDelete
  2. Congratulations Aditya!

    I would like translate your posts to portuguese and publish its in my Blog in Brazil if you agree...

    Tks!

    André Luiz Bernardes
    bernardess@gmail.com
    http://inanyplace.blogspot.com/

    ReplyDelete
  3. Hi Andre,

    You are free to repost these posts in your blog.

    Best Regards,
    Ady.
    "Besides black art, there is only automation"
    Technology Specific Guide For QTP - My new Book on QTP

    ReplyDelete

Post a Comment

Popular posts from this blog

Software Testing @ Microsoft

Trim / Remove spaces in Xpath?