Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Printing a named range | Excel Discussion (Misc queries) | |||
inserting a named range into new cells based on a named cell | Excel Discussion (Misc queries) | |||
Selecting specific row/column from a named range | Excel Worksheet Functions | |||
Selecting Named Ranges | Excel Programming | |||
Selecting Filtered Items from Named range | Excel Programming |