This is a very obscure problem but I am hoping someone can help. I have the following module in a Word XP global template that is located in the startup folder of everyone's machine here at my work. My code checks to see if a printer is installed (called "DPFPrint"
on a user's machine by attempting to change the default printer to DPFPrint. If then changes back to their previous default printer. This code seems to work fine. However, users are reporting that their work is printing out to the DPFPrint printer when it shouldn't be. For instance, one user was printing out information from a website and it went to the DPFPrint printer instead of his local printer. Can anyone see anything wrong with my code that might cause that behavior?
Sub Auto()
Dim MySettings As Variant
MySettings = GetSetting(appname:="Printer", Section:="Docketing", Key:="Exists"
DPFPrinter = "DPFprint"
CurrentPrinter = Application.ActivePrinter
If MySettings = 1 Then
Documents.Add Template:=NormalTemplate.FullName
If ActiveWindow.View.SplitSpecial = wdPaneNone Then
ActiveWindow.ActivePane.View.Type = wdPrintView
Else
ActiveWindow.View.Type = wdPrintView
End If
frmMain.Show
Else:
On Error Resume Next
Application.ActivePrinter = DPFPrinter
myPrinter = Left(Application.ActivePrinter, 8)
'Check to see if the docketing printer is installed
If myPrinter <> DPFPrinter Then
MsgBox "You do not have the docketing printer installed. Please contact the Help Desk."
Exit Sub
End If
Application.ActivePrinter = CurrentPrinter
SaveSetting appname:="Printer", Section:="Docketing", Key:="Exists", setting:=1
Documents.Add Template:=NormalTemplate.FullName
If ActiveWindow.View.SplitSpecial = wdPaneNone Then
ActiveWindow.ActivePane.View.Type = wdPrintView
Else
ActiveWindow.View.Type = wdPrintView
End If
frmMain.Show
End If
Documents.Add Template:=NormalTemplate.FullName
If ActiveWindow.View.SplitSpecial = wdPaneNone Then
ActiveWindow.ActivePane.View.Type = wdPrintView
Else
ActiveWindow.View.Type = wdPrintView
End If
frmMain.Show
End Sub
Sub Auto()
Dim MySettings As Variant
MySettings = GetSetting(appname:="Printer", Section:="Docketing", Key:="Exists"
DPFPrinter = "DPFprint"
CurrentPrinter = Application.ActivePrinter
If MySettings = 1 Then
Documents.Add Template:=NormalTemplate.FullName
If ActiveWindow.View.SplitSpecial = wdPaneNone Then
ActiveWindow.ActivePane.View.Type = wdPrintView
Else
ActiveWindow.View.Type = wdPrintView
End If
frmMain.Show
Else:
On Error Resume Next
Application.ActivePrinter = DPFPrinter
myPrinter = Left(Application.ActivePrinter, 8)
'Check to see if the docketing printer is installed
If myPrinter <> DPFPrinter Then
MsgBox "You do not have the docketing printer installed. Please contact the Help Desk."
Exit Sub
End If
Application.ActivePrinter = CurrentPrinter
SaveSetting appname:="Printer", Section:="Docketing", Key:="Exists", setting:=1
Documents.Add Template:=NormalTemplate.FullName
If ActiveWindow.View.SplitSpecial = wdPaneNone Then
ActiveWindow.ActivePane.View.Type = wdPrintView
Else
ActiveWindow.View.Type = wdPrintView
End If
frmMain.Show
End If
Documents.Add Template:=NormalTemplate.FullName
If ActiveWindow.View.SplitSpecial = wdPaneNone Then
ActiveWindow.ActivePane.View.Type = wdPrintView
Else
ActiveWindow.View.Type = wdPrintView
End If
frmMain.Show
End Sub