|
-
Jul 28th, 2003, 08:28 PM
#1
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.
-
Jul 28th, 2003, 10:44 PM
#2
......
-
Jul 29th, 2003, 01:21 AM
#3
The Application.Quit method has a parameter called SaveChanges, which can be one of the WdSaveOptions constants.
objWord.Application.Quit wdDoNotSaveChanges
The Document.Close method also has a SaveChanges parameter.
-
Jul 29th, 2003, 09:41 PM
#4
thank you!
simply RESOLVED!
thanks!
Jci
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|