× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Vern

I have now created a MS Word VBA macro (auto-generated from Record
Macro, then customized manually):

Sub InsertRTFdocIntoCurrentDocumentAtCurrentCursorPosition()
'
' InsertRTFdocIntoCurrentDocumentAtCurrentCursorPosition Macro
' Macro intended to insert an RTF document from the AS/400 IFS (MUST
ALREADY BE MAPPED to the F: drive) into the current open document at
the current cursor location
'
    Selection.TypeParagraph
    Selection.InsertFile FileName:="F:\DanW\PrintScreen.rtf",
Range:="", _
        ConfirmConversions:=False, Link:=False, Attachment:=False
    Selection.TypeParagraph
End Sub

Is there a way to get a macro executed from a source outside the Word
application and getting it to run on an already opened Word app and an
already opened Word document?  I suppose if I can do this from the
Windows Run command line, I should be able to remotely call it from the
400.  Vern, you mention a VB client that the 400 could call via
RunRmtCmd; would this be something I could build from Word's VBA?  Or
will I need the VB development product?  I'm guessing that the client
would have to find & activate the already-opened Word application, then
execute the macro?  It's been awhile since I've done any VB, but I know
I've never written anything like that before.  I am looking at the MSDN
article you provided a link for, but am going to have to wait til some
after-hours free time to go through it.  Well, maybe not, says you need
VB 5.0 or 6.0, and I don't have access to that.

I noticed in the "Opening PC docs thru AS/400" thread that you
mentioned CA's Incoming Remote Command; I have set that up.  Should the
"Automatically start IRC" box be checked?  This is the "server" you are
talking about?  How does one get it to "run on the PC"?

This macro, by itself, gets me extremely close to the desired goal. 
The RTF file generation is triggered by the Attention key, which calls
my special Attention Key program, which creates an RTF of the current
screen.  (The RTF retains most of the screen attributes - bold,
underline, non-display - and I hope to add reverse image in a future
iteration.)  I need to generate screen prints as part of my QA testing,
and if I can avoid leaving my AS/400 session to have to insert the
generated RTF into the Word document, it will make my testing go much
faster and easier.  This would also be used to create user
documentation.

Note to those who may ask (cuz I've been asked before):  Why RTF and
not a Windows Print Active Window and paste into Word?  RTF is vastly
smaller than the BMP file Windows Print generates.  

TIA, Dan

--- Vern Hamberg <vhamberg@centerfieldtechnology.com> wrote:
> What you want to do is doable. It can't be done directly from 
> the 400, as it needs OLE access to the active Word application.
> But you could have a VB client that you could call with 
> STRPCCMD or RUNRMTCMD, that'd find the open Word application 
> and insert the RTF at the cursor.
> 
> Or can control originate at the PC, with the user who has the
> Word document open? A button could be created that fires off a
> macro to call the CL.
> 
> The scenario you describe feels like pretty loose linkage 
> between the parts of the app. But maybe that's alright.
> 
> Tale a look at this site 
>
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dno2kta/html/offaut.asp>
> 
> on "Automating Microsoft Office 97 and Microsoft Office 2000"
> 
> HTH
> 
> Vern
> 
> At 08:29 AM 1/14/2003 -0800, you wrote:
> >Fellow Midrangers:
> >
> >Is this "pie in the sky" or possible to do?
> >
> >I have an AS/400 application that creates an RTF (Rich Text Format)
> >file on the 400 and then transfers the file to an IFS stream file
> >via CpyToStmf.  I am able to open the file in the IFS and bring it
> >up in MS Word.
> >
> >WHAT I WOULD LIKE TO DO NOW is have a "magic box" thingy that takes
> >the stream file just created in the IFS, preferably in the same 
> >process that creates the stream file, and execute an Insert File
> >command on the RTF file to insert it in the open Word document 
> >whereever the cursor is in the document.  It should be "callable"
> >from the CL program.  This process will be repeated several times,
> >and each generated RTF file should automagically be inserted into
> >the Word document.
> >
> >Assumptions:  MS Word is already open on the client PC, and the
> >document to insert the RTF into is open and is the "active" window.
> >AS/400 is v4r5 (soon to be v5r2 if that makes any difference). 
> >Client PC is Win98se with plenty of memory and horses.  Windows 
> >has a drive mapped to the IFS.
> >
> >FWIW, the IFS file name is generated using the current timestamp
> >(for example DANW011403111125232.rtf), but I could easily make it
> >a single hard-coded name if it would make it easier to do.
> >
> >TIA, Dan


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.