Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 28th, 2007, 05:02 PM
Registered User
 
Join Date: Oct 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Paste to another program, impossible?

This is probably impossible, but it would be very nice if it wasn't.

My company uses a Unix-based system, which is accessed at our Windows workstations using NetTerm, which is an old-fasioned terminal program. Every month, I have a list of reports I want to run on that system. Instead of typing in everything for each one, over five separate screenfuls of data, I have found that I can arrange the entries I need into a column in Excel, copy it, and paste the whole thing into the NetTerm window. That zips through the screens and prints out my report.

I have made a script that sets them up one at a time, and copies the range, then pops up a MessageBox to let me know that I can paste them. I have to right-click in the NetTerm window and select Paste, then hit the MessageBox button, which sets up the data range for the next report, copies it, and I have to paste it into NetTerm again.

What I'd like to do, is to have the script itself "Paste" the data into the NetTerm window. Then I could just hit the button, wait for the report to finish, and hit it again instead of right-click/pasting so many times.

I know you can paste into another Excel window, or even another Office program, but is there any way to paste into a non-Microsoft program without changing to that window, pasting, and changing back?
 
Old November 28th, 2007, 08:36 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

You can try it out with SendKeys command. You can activate the other window (NetTerm) and Send the Keys (like Ctrl + V etc). Not sure .. but you can try it our


http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old November 30th, 2007, 05:01 PM
Registered User
 
Join Date: Oct 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How do I activate the NetTerm window, since it wasn't started from Excel? If I could do that, it might work. If it was explained in the link, please forgive me, but blogspot is totally blocked here. (Company policy. We're lucky to be allowed to use computers at all.)
 
Old November 30th, 2007, 09:51 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi David

If your NetTerm window is open already you can use

AppActivate "NetTerm"

Or use the Shell Function to start NetTerm and then activate it

MyAppID = Shell("C:NetTerm.EXE", 1)
AppActivate MyAppID

Cheers
Shasur

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old December 3rd, 2007, 11:24 AM
Registered User
 
Join Date: Oct 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That did it! Thanks.

I will admit that I hadn't thought of SendKeys. I'm so used to rightclick/paste that I forget that it can also be done with keystrokes. "%EP" So simple.

Now, back to trying to automate my way out of a job. :)





Similar Threads
Thread Thread Starter Forum Replies Last Post
This may be impossible... hsogs Access 1 June 16th, 2008 05:39 PM
SCJP is looking impossible for me. srikrishna JSP Basics 0 October 23rd, 2006 12:53 PM
combining values from for-each loop..impossible? Brian Campbell XSLT 2 June 6th, 2006 10:58 AM
Impersonate impossible on remote SQL Server? greamb Classic ASP Databases 2 December 10th, 2004 06:15 AM
Impossible MySQL Query? mrcornelia SQL Language 4 November 18th, 2003 03:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.