Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selecting/Printing a Named Range via VBA

I had the same problem. It worked fine on my computer, but when I ran it from a user's computer I got the same error as you. Selecting the range first before setting the print area seems to have resolved it

I'm using Office 2000 on my computer, my user has Office 97

Hope this helps


----- M wrote: ----

I am using a form in Access 97 to open an Excel template
containing various charts. There are several worksheets
with one chart on each sheet. I have code that executes
based on checkbox selections that in turn prints the
selected charts. Here is the code

If MyForm!chkPrintChart1.Value = True The
Set xlsWorksheet = xlsWorkbooks.Worksheets(1
xlsWorksheet.PrintOu
Set xlsWorksheet = Nothin
End I

This code works fine until the user changes the
destination printer. I want to reset the PrintArea to a
named range whenever the printer is changed. So far I have
used this line

xlsWorksheet.PageSetup.PrintArea="DisbursementsPri ntArea1

inserted before the 'xlsWorksheet.PrintOut' line, but I am
getting a RunTime error 1004 'Unable to set PrintArea
property of the PageSetup class'.

So I tried this

Set xlsRange=xlsWorksheet.Name
("DisbursementsPrintArea1").RefersToRang

If MyForm!chkPrintChart1.Value = True The
Set xlsWorksheet = xlsWorkbooks.Worksheets(1
Set xlsRange=xlsWorksheet.Name
("DisbursementsPrintArea1").RefersToRang
xlsRange.Selec
xlsRange.PrintOu
Set xlsRange = Nothin
Set xlsWorksheet = Nothin
End I

But I now get RunTime error 1004 'Application defined or
Object-defined error

I have also tried selecting the ChartObject itself on the
selected Worksheet but this hasn't worked either

I know this can work --- How

Thank






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 a named range RheaS Excel Discussion (Misc queries) 1 June 27th 07 07:28 PM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM
Selecting specific row/column from a named range [email protected] Excel Worksheet Functions 2 November 16th 05 09:24 PM
Selecting Named Ranges Ian[_8_] Excel Programming 7 September 22nd 03 03:32 PM
Selecting Filtered Items from Named range Soniya Excel Programming 2 August 20th 03 10:59 AM


All times are GMT +1. The time now is 01:41 AM.

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

About Us

"It's about Microsoft Excel"