Results 1 to 4 of 4

Thread: Copy flex- Paste into some appl. I cant remove alerts from word...[RSOLVED]

Threaded View

  1. #1

    Thread Starter
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Thumbs up Copy flex- Paste into some appl. I cant remove alerts from word...[RSOLVED]

    HI, Im using this code to COPY from my app. so the user can PASTE Later somewhere (excel, word..).
    But after copy to clipboard and quit word object it fires "do you want to save unsaved file?"

    How can i close the document using an object like this??
    Displayalerts=false is not working.

    This is the code:

    ----------------------------------------------------------------------------
    Code:
    Private Sub CopyGrid()
    On Error GoTo ErrorHand:
    Dim objWord As Object 'instead of Word.Application
    Dim objDoc As Object  'instead of Word.Document
    
    Dim strData As String
        
    If objWord Is Nothing Then
            Set objWord = CreateObject("Word.Application")
        Else
            Set objWord = GetObject(, "Word.Application")
    End If
    DoEvents
        
    With MSFlexGrid1
         .Row = 0
         .Col = 1
         .RowSel = .Rows - 2
         .ColSel = .Cols - 1
         strData = .Clip
    End With
    
    'The Clip property separates Rows with a carriage return.  These
    'need to be converted to Tabs as well in order to create the Word Table properly.
    strData = Replace(strData, vbCr, vbTab)
        
    Clipboard.Clear
    Clipboard.SetText strData
    
    'saco las alertas de word
        
    'Create the Word Table by pasting the Grid Text into a document
    'and then use the ConvertToTable method
    Set objWord = New Word.Application
    Set objDoc = objWord.Documents.Add
    objDoc.Range.Paste
    objDoc.Range.ConvertToTable wdSeparateByTabs, MSFlexGrid1.Rows - 2, MSFlexGrid1.Cols - 1
    
    'Copy the Word Table to the Clipboard.  The user can then Paste
    'the table into their word documents.
    objDoc.Range.Copy
    objWord.DisplayAlerts = False
    
    '----------------------- quit word --------------------------
        If Not (wd Is Nothing) Then Set wd = Nothing
        If Not (objWord Is Nothing) Then objWord.Application.Quit
        If Not (objWord Is Nothing) Then Set objWord = Nothing
    '------------------------------------------------------------
    
    ErrorHand:
        Resume Next
    End Sub
    Last edited by jcis; Jul 29th, 2003 at 09:42 PM.

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