Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Printing query with Sendkeys

Good afternoon. I wonder if someone could offer some advice with a
small problem I am currently having. I use Excel in two environments,
Excel 2002 and Windows XP and also Excel 2002 with Windows Server 2003
(using Citrix Terminal Services). We have a scenario where a report is
exported from a third party product into Excel. The resulting
spreadsheet then needs to be printed to a printer which has two paper
trays taking one copy from tray 1 and four copies from tray 2. I want
to do this using a macro. After searching through the newsgroups I
decided the best way to do this would be to use SendKeys rather than
set up a second printer with the default tray 2 as we use Auto Created
printers in Citrix and I'm not sure how easy this would be (however
given my problems I may have to!). When I'm using Excel with Windows
XP my SendKeys code works beautifully, but when I test it out in the
Windows Server 2003 environment it falls apart and just won't work. I
can't understand why and wondered if there was maybe something I'm
missing. I'm a "simple" VBA user so my code may appear ridiculous but
it did work!

'Select correct printer
Application.ActivePrinter = "IT1 on Ne15:"
'Print one copy of current worksheet on headed paper
SendKeys "%R^{TAB}%S%{DOWN}TRAY 2{TAB}~~"
Application.Dialogs(xlDialogPrint).Show

My Sendkeys statement is supposed to go to the printer driver and
change the default bin.

If anyone can offer any suggestions I would appreciate it. However, I
understand I may need to go to the second printer route.

Thanks

Laura
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Printing query with Sendkeys

My guess is that the "server environment" runs a lot slower. Macros ru
very fast and the system can not keep up.

You will need to break down your Sendkeys into several parts and pu
delays in the code to give time for things to happen. Takes a bit o
tweaking. This line delays code for 1 second :-

Application.Wait Now + TimeValue("00:00:01"

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Printing query with Sendkeys

oops ... PS ...........
don't forget to use Sendkeys .... , True.

Try putting some DoEvents lines in too - although I have never notice
a difference using this

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Printing query with Sendkeys

Brian, thanks for replying. I will go and try this and let you know how I get on.

Laura
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing and emailing query dragons_lair Excel Worksheet Functions 2 June 3rd 09 03:05 AM
Excel 2003 Import - Web Query - Results = Printing Version Mark Excel Worksheet Functions 0 March 28th 07 02:51 AM
Excel printing query Linda Excel Discussion (Misc queries) 2 April 24th 05 11:56 PM
Sendkeys GB[_3_] Excel Programming 0 September 16th 03 10:39 PM
SendKeys Ron de Bruin Excel Programming 3 August 25th 03 10:21 PM


All times are GMT +1. The time now is 11:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"