|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Copying from Clipboard
Hi,
I want to get the contents that are copied from a word file onto a clipboard to be saved as another Word file. I open a new word file and set it's content as Clipboard.GetText . The content copied gets saved, but the format is lost. How can I retain the format of the copied content? Any suggestions/help please?????? |
|
#2
|
|||
|
|||
|
Quote:
Open the word document (as an object in VB) and select the text copy it and paste into the other document, dont use the gettext. Use Dim WRD As Word.Document and the content is WRD.content you can set one document .content = to the other. |
|
#3
|
|||
|
|||
|
That is what I did. The formatting is lost while I do so. I want to retain the format.
|
|
#4
|
|||
|
|||
|
Remember to use the Outlook's facility to create macros, it may be something like that
Code:
Sub WordCopyRows(FILE1 as String, ROWS As Integer)
Dim status As Boolean
Dim objWord As Word.Application
Dim objDoc As Word.Document
Dim objDoc_in As Word.Document
status = False
On Error GoTo ErrorHandler
Set objWord = CreateObject("word.application")
objWord.Visible = True
objWord.WindowState = wdWindowStateMaximize
Set objDoc = objWord.Documents.Add(DocumentType:=wdNewBlankDocu ment)
TXT = objDoc.Application.ActiveDocument.Name
Set objDoc_in = objWord.Documents.Open(FILE1)
objWord.Selection.MoveStart
objWord.Selection.MoveDown Unit:=wdLine, Count:=ROWS, Extend:=wdExtend
Selection.Copy
objWord.Windows(TXT).Activate
Selection.Paste
GoTo NormalExit
ErrorHandler:
MsgBox "The following error occured " & vbCrLf & Err.Description
NormalExit:
objDoc_in.Close savechanges:=wdNoSaveChanges
Set objWord = Nothing
Set objDoc = Nothing
Set objDoc_in = Nothing
End Sub
|
|
#5
|
|||
|
|||
|
I shall try this and let you know..... Thanks for the help.
|
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Copying from Clipboard |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|