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 August 9th, 2007, 11:20 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
Clipboard content not available

Hi,

I have an application that would copy the contents from an IE's word component, open a word document and paste the copied contents into that opened document. The following is part of the code

vb Code:
Original - vb Code
  1.  
  2. Dim oWord As Object
  3. Dim oDoc As Object
  4.  
  5.     Clipboard.Clear
  6.     AppActivate "C:\WINDOWS\test.htm - Microsoft Internet Explorer", True
  7.     SendKeys "^a", True
  8.     SendKeys "^c", True
  9.    
  10.     If Trim(Clipboard.GetText) = "" Then
  11.         MsgBox "Content was not copied onto clipboard.Please set the focus onto the test html page and try again", vbOKOnly, "Copy contents"
  12.         Exit Sub
  13.     End If
  14.  
  15.     MsgBox Clipboard.GetText
  16.    
  17.     Set oWord = CreateObject("Word.Application")
  18.     Set oDoc = oWord.Documents.Add
  19.    
  20.     MsgBox Clipboard.GetText
  21.    
  22.     oWord.Selection.Paste
  23.     oWord.Visible = True
  24.    
  25.     MsgBox Clipboard.GetText
  26.     'oDoc.Activate
  27.     oDoc.SaveAs FileName:="C:\test.doc"
  28.     oDoc.Close
  29.    
  30.     Set oWord = Nothing
  31.     Set oDoc = Nothing
  32.  


When I am running this application, after the contents are copied to the clipboard, I am getting the text from clipboard in the alert. After the word object is invoked to open a new word document, the clipboard content is not present.

This works in few systems I don't come across this error. Is there any Dll that needs to be registered in the systems for the content to be available?

Reply With Quote
  #2  
Old August 9th, 2007, 07:23 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 57 m 26 sec
Reputation Power: 181
If it helps, in XP Pro/Office 2003 I've noticed opening some applications manually seems to empty the clipboard. Maybe the problem is in word, not your code, but I'm only guessing.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #3  
Old August 10th, 2007, 09:44 AM
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
Agree, maybe you can open word before copying the data to clipboard but IMHO could be better

Being WebB a Web browser

Code:
WebB.Navigate2 "file://" & C:\WINDOWS\test.htm"
    Do
      DoEvents
    Loop Until Not (WebB.Busy)
    If InStr(1, "The Page cannot be displayed",     If InStr(1, "The Page cannot be displayed", WebB.Document.body.innerHTML, vbTextCompare) <> 0 Then TXT = ""
    If TXT <> "" Then TXT_OUT = WebB.Document.body.innerHTML

Reply With Quote
  #4  
Old August 10th, 2007, 10:15 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 tried opening word before copying the contents after that. That also did not work...

Reply With Quote
  #5  
Old August 10th, 2007, 12:34 PM
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
Oops. I am sorry. I tried creating the word object first and then did the copy to clipboard. It worked.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Clipboard content not available


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 4 hosted by Hostway
Stay green...Green IT