SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 10 of 10
  1. #1
    Member
    Join Date
    Jul 2005
    Location
    Chennai
    Posts
    31
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    how to paste something in Word

    Hi,
    I wanted to paste a copied content in a word document. when i try recording the same, nothing is getting recorded.
    Any tips on this?
    Best Regards,
    Chandrammohan.S

  2. #2
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: how to paste something in Word

    You need to use Word COM automation model for that.

  3. #3
    Member
    Join Date
    Jul 2005
    Location
    Chennai
    Posts
    31
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to paste something in Word

    Tarun,
    What should i do to get Word COM automation model?Is there any other ways to store the copied content and fetch values from that and store them in variables?
    Best Regards,
    Chandrammohan.S

  4. #4
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: how to paste something in Word

    Search the forum and you will find code like something below

    Set wordApp=CreateObject("Word.Application")

    u can also refer below urls

    http://msdn.microsoft.com/library/de...jectmodels.asp
    http://msdn2.microsoft.com/kw65a0we.aspx

  5. #5
    Member
    Join Date
    Jul 2005
    Location
    Chennai
    Posts
    31
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to paste something in Word

    Tarun,
    Thanks a lot Tarun.I tried like this,

    copyClipboardToFile("C:\Documents and Settings\hisfcxs\My Documents\C1.doc")
    Function copyClipboardToFile(byVal file)
    Dim fso, thisFile, clip
    const WRITING = 2 'If file exists open to write
    Const CF_TEXT = 1 'To make sure that only text can be copy
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set clip = CreateObject("Mercury.Clipboard")
    If not (fso.FileExists(file)) Then
    Set thisFile = fso.CreateTextFile(file, True)
    else
    Set thisFile = fso.OpenTextFile(file, WRITING, True)
    end if
    If clip.GetFormat(CF_TEXT) Then
    buffer = clip.GetText(CF_TEXT) 'get content from clipboard
    lines = split(buffer,vbNewLine) 'split it in lines
    For i = 0 To Ubound(lines)
    thisFile.WriteLine(lines(i))
    Next
    end if
    thisFile.Close 'close file before exiting function
    end function

    but it gives an activex error like this,

    "ActiveX component can't create object: 'Mercury.Clipboard'
    Line (43): "Set clip = CreateObject("Mercury.Clipboard")". "
    Y is this error popping up.Any suggestions on this?
    Best Regards,
    Chandrammohan.S

  6. #6
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: how to paste something in Word

    Have you installed QTP Plus. The component is part of that installation. If you have not installed it already then do it from QTP folder in program menu.

  7. #7
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: how to paste something in Word

    Okie..then install it and one more thing that the file you are creating is a plain text file and not a word document. You can open it in word as it a text file and since you are giving the extenstion as .doc, it will open in word by default. I would suggest that if you dont want it in the word format better rename your file to .txt instead of .doc.

  8. #8
    Member
    Join Date
    Jul 2005
    Location
    Chennai
    Posts
    31
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to paste something in Word

    Thanks Tarun, its not been installed in my system.
    Best Regards,
    Chandrammohan.S

  9. #9
    Member
    Join Date
    Jul 2005
    Location
    Chennai
    Posts
    31
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to paste something in Word

    Sure, I will do that.

    Thanks a lot for the timely help Tarun.
    Best Regards,
    Chandrammohan.S

  10. #10
    Member
    Join Date
    Jul 2005
    Location
    Chennai
    Posts
    31
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: how to paste something in Word

    I installed QTPPlus and its working fine.I have changed the extension to .txt. Thanks a lot Tarun.
    Best Regards,
    Chandrammohan.S

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 12.50%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 04:21 PM.

Copyright BetaSoft Inc.