Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 21st, 2007, 07:36 AM
sanjanah_verma sanjanah_verma is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 190 sanjanah_verma User rank is Corporal (100 - 500 Reputation Level)sanjanah_verma User rank is Corporal (100 - 500 Reputation Level)sanjanah_verma User rank is Corporal (100 - 500 Reputation Level)sanjanah_verma User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 7 h 16 m 13 sec
Reputation Power: 6
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??????

Reply With Quote
  #2  
Old June 21st, 2007, 12:25 PM
Darius Darius is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 108 Darius User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 16 m 54 sec
Reputation Power: 5
Quote:
Originally Posted by sanjanah_verma
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??????

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.

Reply With Quote
  #3  
Old June 22nd, 2007, 10:25 AM
sanjanah_verma sanjanah_verma is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 190 sanjanah_verma User rank is Corporal (100 - 500 Reputation Level)sanjanah_verma User rank is Corporal (100 - 500 Reputation Level)sanjanah_verma User rank is Corporal (100 - 500 Reputation Level)sanjanah_verma User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 7 h 16 m 13 sec
Reputation Power: 6
That is what I did. The formatting is lost while I do so. I want to retain the format.

Reply With Quote
  #4  
Old June 26th, 2007, 03:55 PM
Darius Darius is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 108 Darius User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 16 m 54 sec
Reputation Power: 5
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

Reply With Quote
  #5  
Old June 28th, 2007, 03:54 AM
sanjanah_verma sanjanah_verma is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 190 sanjanah_verma User rank is Corporal (100 - 500 Reputation Level)sanjanah_verma User rank is Corporal (100 - 500 Reputation Level)sanjanah_verma User rank is Corporal (100 - 500 Reputation Level)sanjanah_verma User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 7 h 16 m 13 sec
Reputation Power: 6
I shall try this and let you know..... Thanks for the help.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Copying from Clipboard


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT