A strange problem Need help

B

bhodge

Hello,

I have created a macro which uses the line:

Application.ActivePrinter = "Microsoft Office Document
Image Writer on Ne00:"

This helps speed up the macro. The problem I am running
into is I have 2 users who get the "Run Time Error 1004
Method 'ActivePrinter' object_applicated failed" message.
There is 4 users total including myself (creator of
macro). 1 other user can use the Macro, but the 2 who can
not, have just been given new computers (all of us are
running Excel 2003). Any idea why the 2 new users are
getting this error? Below is my entire macro. Thanks for
your help!


Sub Oneyear()
'
' Oneyear Macro
' Oneyear recorded 2/6/2004 by bhodge
'

'

Application.ActivePrinter = "Microsoft Office Document
Image Writer on Ne00:"
Dim AWB As Workbook
Set AWB = ActiveWorkbook
Application.ScreenUpdating = False
AWB.Activate
Workbooks.Open Filename:= _
"G:\Contract QuoteTemplates\Email Template
Macro.xls"
AWB.Activate
Windows("Email Template Macro.xls").Activate
Sheets("Features").Select
Sheets.Add
Sheets("Sheet1").Select
Sheets("Sheet1").Move After:=Sheets(3)
Sheets("Sheet1").Name = "Terms and Conditions"
AWB.Activate
Sheets("Terms and Conditions").Select
Cells.Select
Selection.Copy
Windows("Email Template Macro.xls").Activate
ActiveSheet.Paste
Range("A1").Select
AWB.Activate
Sheets("Quote Header").Select
Sheets("Quote Header").Copy Before:=Workbooks("Email
Template Macro.xls"). _
Sheets(1)
Cells.Select
Selection.Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
AWB.Activate
Sheets("Cover").Select
Sheets("Cover").Copy Before:=Workbooks("Email Template
Macro.xls").Sheets(2)
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
AWB.Activate
Sheets("Agreement").Select
Sheets("Agreement").Copy Before:=Workbooks("Email
Template Macro.xls").Sheets _
(3)
Cells.Select
Selection.Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Cells.Select
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
End With
Sheets("Cover").Select
Cells.Select
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
End With
Sheets("Quote Header").Select
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
End With
Range("D12").Select
Sheets("Cover").Select
Sheets("Cover").Name = "1YR Cover"
Sheets("Agreement").Select
Sheets("Agreement").Name = "1YR Agreement"
Range("F23").Select
Sheets("Quote Header").Select
Range("D4").Select
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.5)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.CenterHorizontally = True
.CenterVertically = True
.Zoom = 90
End With
Sheets("1YR Cover").Select
Range("B8").Select
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.5)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.CenterHorizontally = True
.CenterVertically = True
.Zoom = 100
End With
Sheets("Terms and Conditions").Select
With ActiveSheet.PageSetup
.LeftFooter = _
"&6Psion Teklogix Maintenance Terms and Conditions
NA C.1 April 2003" & Chr(10) & "" & Chr(10) & "This
document and its content is Psion Teklogix proprietary and
shall not be reproduced or disclosed to any third party
without prior written consent."
.CenterFooter = ""
.RightFooter = "Page &P of &N"
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.75)
.FooterMargin = Application.InchesToPoints(0.3)
.Orientation = xlLandscape
.Zoom = 100
End With
Sheets("1YR Agreement").Select
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.5)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlLandscape
.Zoom = 70
Application.ScreenUpdating = True
End With
End Sub
 
B

bhodge

They do. I have found out that their computers have named
the Image Writer as ne02 instead of ne00. So, either I
will have to create a seperate Macro for the ne02 printers
or find a way where I can reference both ne00 and ne02 in
the same macro and have the macro determine which one the
user uses.
 
G

Guest

Ideally, you would rename the printer on their computer. Or.

You could put an "On Error Resume Next" statement prior to your assignment, then test the result immediately after

On Error Resume Nex
Application.ActivePrinter = "Microsoft Office Document Image Writer on Ne00:"
If Err.Number = 1004 The
Application.ActivePrinter = "Microsoft Office Document Image Writer on Ne02:"
Err.Clea
End i

You'd probably want to setup some error handling here after, though

-Bra
 
B

bhodge

Brad,

Thanks for your help. That worked. I didn't need to put an
error handler after, it just worked. Thanks.

-----Original Message-----
Ideally, you would rename the printer on their computer. Or..

You could put an "On Error Resume Next" statement prior
to your assignment, then test the result immediately after.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top