Results 1 to 2 of 2

Thread: Pasting Clipboard data?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    2
    Dr. Nitro - first, thanks for your response.

    I tried AppActivate/SendKeys before but it's just too fickle - it works maybe 1 in 10 times. I'm not sophisticated enough to make it work.

    I shied away from your suggestion to use CreateObject because I'll be pasting thousands of times - the idea of so many word documents was too scary.

    So instead I'm working on your suggestion to use GetObject but Extra doesn't seem to be using it: the macro compiles ok, and the code runs without incident, but my GetObject variable has no value. Needless to say, none of my commands referencing the object variable work. I'm kind of at a loss here - any help would be very appreciated.

    Thanks


  2. #2
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Dr. B8

    Why not paste, save, and close it? Then you won't have thousand documents open. As I said before, I recommend either CreateObject or GetObject. You are right, App.activate and SendKeys are not reliable. I am not working for BOEING anymore, and therefore, I don't remember how Extra Attachmate uses their GetObject. The only example I have for you is the following.

    Code:
    Sub pWord(strCustomizeDirectory As String)
      Dim xlApp As Object
      Set xlApp = CreateObject("Word.Application")
      xlApp.Visible = True
      DoEvents  'Pause until everything previously has been process
    
    '  PURPOSE:Technique to run a macro in another Microsoft Application
    '  Another technique would be sticking the pBrain
    '  macro in "Macro.doc" into the "Open" event
      xlApp.Documents.Open FileName:=gstrTemplateDirectory & "Macro.doc", PasswordDocument:="Testing"
      
    ' PURPOSE: Call this macro
      xlApp.Run MacroName:="pBrain"
      Set xlApp = Nothing
    
    ' PURPOSE:             COPY AND DELETE DOCUMENT FILES
      Dim strExistingFile As String
      strExistingFile = Dir(gstrProcessAreaDirectory & "*.*")
      Do Until strExistingFile = ""
        DoEvents  'Pause until everything previously has been process
        
        If Right(strExistingFile, 3) <> "txt" And Right(strExistingFile, 3) <> "xls" Then
          'PURPOSE:Copy all files to the customize directory except for
          '        files with the prefix "Master_" or extention of "txt"
          If Left(strExistingFile, 7) <> "Master_" Then
            FileCopy gstrProcessAreaDirectory & strExistingFile, strCustomizeDirectory & strExistingFile
          End If
          'PURPOSE:Delete all files except for files with extention "txt"
          Kill gstrProcessAreaDirectory & strExistingFile
        End If
        
        strExistingFile = Dir()
      Loop
    End Sub
    If you need additional help, just use the recorder in Microsoft Word.

    Good Luck Dr. B8!
    Chemically Formulated As:
    Dr. Nitro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width