+ Reply to Thread
Results 1 to 7 of 7

Append to rtf doc issue

  1. #1
    Registered User
    Join Date
    02-12-2013
    Location
    usa
    MS-Off Ver
    Excel 2003=7
    Posts
    13

    Append to rtf doc issue

    This is probably something simple, but I just can't figure it out and researched till crazy.
    Code copies text from a mainframe session then appends the data to a rtf document that is created. The error where it is crashing is below.

    Thank you!

    Set host = CreateObject("BZWhll.WhllObj") 'set object to bluezone mf app
    ResultCode = host.Connect("A")

    strFile = "k:\" & "ScreenPrint" & Replace(Date, "/", "_") & "-" & Replace(Time, ":", "_") & ".rtf"
    ifn = FreeFile
    Open strFile For Append As ifn

    host.Copy 32
    ifn.Selection.Paste <<<<< ERROR: Object requred
    Close ifn

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Append to rtf doc issue

    Suggest trying to paste into an empty workbook sheet and then printing, line by line, to the RTF file.
    Martin

  3. #3
    Registered User
    Join Date
    02-12-2013
    Location
    usa
    MS-Off Ver
    Excel 2003=7
    Posts
    13

    Re: Append to rtf doc issue

    Not printing the info screen shots, just appending to the file with the screen shots.

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Append to rtf doc issue

    OK - you might want to paste the images into Word and then save the document as an RTF file.

  5. #5
    Registered User
    Join Date
    02-12-2013
    Location
    usa
    MS-Off Ver
    Excel 2003=7
    Posts
    13

    Re: Append to rtf doc issue

    OK, but what is the fix to the code I posted?

  6. #6
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Append to rtf doc issue

    It's difficult to test but hopefully something like

    Please Login or Register  to view this content.
    You will need to make a reference to the Microsoft Word Object Library (Tools in the VBA editor)

  7. #7
    Registered User
    Join Date
    02-12-2013
    Location
    usa
    MS-Off Ver
    Excel 2003=7
    Posts
    13

    Re: Append to rtf doc issue

    Thank you! Needed to add a few more lines of code to adapt it to what I needed. But it works. I think the main thing I forgot was to add the word object library (I always forget that part, doh!).

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Append a Tab Name
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-04-2013, 11:09 AM
  2. Issue with X axis values NOT graphing on Scatter graph and issue with Labels
    By lmausolf in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-17-2012, 07:20 AM
  3. How To Append?
    By fredmeister in forum Excel General
    Replies: 3
    Last Post: 10-17-2011, 04:36 AM
  4. Append 2nd Row to 1st Row
    By pr4t3ek in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-21-2008, 09:27 PM
  5. append data
    By jam0678 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2006, 07:48 AM
  6. [SOLVED] Paste Append?
    By Kris in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2006, 11:30 PM
  7. What can I append
    By David in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-19-2005, 06:05 PM
  8. How to append to a cell..?
    By someonestoleit in forum Excel General
    Replies: 3
    Last Post: 03-16-2005, 11:53 AM

Bookmarks

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 Friendly URLs by vBSEO 3.6.0 RC 1