C
Calvin Lai
When I click on a button in the toolbar in Word, I'm supposed to get
Print Options dialog box as specified in the macro. Instead I'm
getting a Save As dialog box which opens up the folder which I have
specified in TOOLS > OPTIONS > FILE LOCATIONS. When I click Cancel, I
get Run-time error '4198'. Any ideas????????????
We did a migration last nite and and made changes to normal.dot.
ActivePrinter was "\\LEGAL\LASERJET 4M" but has been changed to
"\\FPSERVER\9103HP11". Any ideas?
Public Sub Main()
Dim a
Dim z
Dim b
Dim bb
Dim c
Dim cc
Dim d
Dim dd
Dim e
Dim f
Dim p
Dim g
ActiveDocument.Save
ActiveDocument.Content.Select 'select all
ActiveDocument.Fields.Update
Selection.HomeKey Unit:=wdStory
Start:
WordBasic.BeginDialog 276, 275, "Print Options"
WordBasic.Text 10, 6, 245, 13, "Please Select Your Print Option ",
"Text1"
WordBasic.PushButton 10, 26, 255, 21, "&1 - Pleadings Bond",
"Push1"
WordBasic.PushButton 10, 51, 255, 21, "&2 - Letterhead", "Push2"
WordBasic.PushButton 10, 101, 120, 21, "&3 - BCC", "Push3"
WordBasic.PushButton 10, 76, 255, 21, "&4 - FaxPress", "Push4"
WordBasic.PushButton 145, 101, 120, 21, "&5 - Copy", "Push5"
WordBasic.PushButton 10, 126, 120, 21, "&6 - File Copy", "Push6"
WordBasic.PushButton 10, 151, 120, 21, "&7 - Manual Feed", "Push7"
WordBasic.PushButton 145, 126, 120, 21, "&8 - Draft", "Push8"
WordBasic.PushButton 145, 151, 120, 21, "&9 - Print", "Push9"
WordBasic.PushButton 10, 181, 255, 21, "&Envelope/Label", "Push10"
WordBasic.CancelButton 10, 215, 255, 46
WordBasic.EndDialog
Dim dlg As Object: Set dlg = WordBasic.CurValues.UserDialog
'Define the dialog record
a = WordBasic.Dialog.UserDialog(dlg) 'Display the dialog box
If a = 1 Then
GoTo Bond
ElseIf a = 2 Then
GoTo Legal
ElseIf a = 3 Then
GoTo BCC
ElseIf a = 4 Then
GoTo Fax
ElseIf a = 5 Then
Application.Run MacroName:="Copy.MAIN"
Application.Run MacroName:="Printer_Copy"
GoTo last
ElseIf a = 6 Then
GoTo File
ElseIf a = 7 Then
Manual:
Application.Run MacroName:="ManualFeed"
WordBasic.BeginDialog 420, 69, "Manual Feed Options"
WordBasic.Text 10, 6, 410, 13, "Do You Want to Print Additional
Manual Feed Copies?", "Text1"
WordBasic.PushButton 76, 25, 88, 21, "&Yes", "Push1"
WordBasic.PushButton 217, 25, 88, 21, "&No", "Push2"
WordBasic.EndDialog
Set dlg = WordBasic.CurValues.UserDialog
Set dlg = WordBasic.CurValues.UserDialog 'Define the dialog
record
z = WordBasic.Dialog.UserDialog(dlg) 'Display the dialog box
If z = 1 Then
GoTo Manual
ElseIf z = 2 Then
GoTo last
End If
ElseIf a = 8 Then
Application.Run MacroName:="Draft"
GoTo last
ElseIf a = 9 Then
Top:
Application.Run MacroName:="Printer"
WordBasic.BeginDialog 420, 69, "Additional Copies"
WordBasic.Text 10, 6, 410, 13, "Do You Want to Print Additional
Copies?", "Text1"
WordBasic.PushButton 76, 25, 88, 21, "&Yes", "Push1"
WordBasic.PushButton 217, 25, 88, 21, "&No", "Push2"
WordBasic.EndDialog
Set dlg = WordBasic.CurValues.UserDialog
Set dlg = WordBasic.CurValues.UserDialog 'Define the dialog
record
z = WordBasic.Dialog.UserDialog(dlg) 'Display the dialog box
If z = 1 Then
GoTo Top
ElseIf z = 2 Then
GoTo last
End If
ElseIf a = 10 Then
GoTo Envelope
Else
GoTo last
End If
Bond:
Application.Run MacroName:="Bond"
WordBasic.BeginDialog 420, 69, "Additional Copies"
WordBasic.Text 10, 6, 410, 13, "Do You Want to Print Additional
Copies?", "Text1"
WordBasic.PushButton 76, 25, 88, 21, "&Yes", "Push1"
WordBasic.PushButton 217, 25, 88, 21, "&No", "Push2"
WordBasic.EndDialog
Set dlg = WordBasic.CurValues.UserDialog
Set dlg = WordBasic.CurValues.UserDialog 'Define the dialog
record
z = WordBasic.Dialog.UserDialog(dlg) 'Display the dialog box
If z = 1 Then
GoTo Bond
ElseIf z = 2 Then
GoTo last
End If
Legal:
WordBasic.EndOfDocument
Application.Run MacroName:="Bond"
WordBasic.BeginDialog 293, 86, "BCC Information"
WordBasic.Text 10, 6, 272, 13, "Do You Want to Print a BCC
Copy?", "Text1"
WordBasic.PushButton 39, 23, 88, 21, "&Yes", "Push1"
WordBasic.PushButton 170, 24, 88, 21, "&No", "Push2"
WordBasic.CancelButton 111, 59, 88, 21
WordBasic.EndDialog
Set dlg = WordBasic.CurValues.UserDialog
Set Dlg1 = WordBasic.CurValues.UserDialog
Dim Dlg2 As Object: Set Dlg2 = WordBasic.CurValues.UserDialog
'Define the dialog record
c = WordBasic.Dialog.UserDialog(Dlg2) 'Display the dialog box
If c = 1 Then
Application.Run MacroName:="BCC"
GoTo last
ElseIf c = 2 Then
WordBasic.BeginDialog 293, 86, "File Copy Information"
WordBasic.Text 10, 6, 272, 13, "Do You Want to Print a File
Copy?", "Text1"
WordBasic.PushButton 39, 23, 88, 21, "&Yes", "Push1"
WordBasic.PushButton 170, 24, 88, 21, "&No", "Push2"
WordBasic.EndDialog
Set dlg = WordBasic.CurValues.UserDialog
Set Dlg1 = WordBasic.CurValues.UserDialog
Set Dlg2 = WordBasic.CurValues.UserDialog
Set dlg = WordBasic.CurValues.UserDialog 'Define the dialog
record
cc = WordBasic.Dialog.UserDialog(dlg) 'Display the dialog box
If cc = 1 Then
GoTo File
ElseIf cc = 2 Then
GoTo last
End If
End If
Fax:
Application.Run MacroName:="FaxPress"
WordBasic.BeginDialog 293, 86, "BCC Information"
WordBasic.Text 10, 6, 272, 13, "Do You Want to Print a BCC
Copy?", "Text1"
WordBasic.PushButton 39, 23, 88, 21, "&Yes", "Push1"
WordBasic.PushButton 170, 24, 88, 21, "&No", "Push2"
WordBasic.CancelButton 111, 59, 88, 21
WordBasic.EndDialog
Set dlg = WordBasic.CurValues.UserDialog
Set Dlg1 = WordBasic.CurValues.UserDialog
Set Dlg2 = WordBasic.CurValues.UserDialog
Dim Dlg3 As Object: Set Dlg3 = WordBasic.CurValues.UserDialog
'Define the dialog record
d = WordBasic.Dialog.UserDialog(Dlg3) 'Display the dialog box
If d = 1 Then
Application.Run MacroName:="BCC"
GoTo last
ElseIf d = 2 Then
WordBasic.BeginDialog 293, 86, "File Copy Information"
WordBasic.Text 10, 6, 272, 13, "Do You Want to Print a File
Copy?", "Text1"
WordBasic.PushButton 39, 23, 88, 21, "&Yes", "Push1"
WordBasic.PushButton 170, 24, 88, 21, "&No", "Push2"
WordBasic.EndDialog
Set dlg = WordBasic.CurValues.UserDialog
Set Dlg1 = WordBasic.CurValues.UserDialog
Set Dlg2 = WordBasic.CurValues.UserDialog
Set Dlg3 = WordBasic.CurValues.UserDialog
Set dlg = WordBasic.CurValues.UserDialog 'Define the dialog
record
dd = WordBasic.Dialog.UserDialog(dlg) 'Display the dialog box
If dd = 1 Then
GoTo File
ElseIf dd = 2 Then
GoTo last
End If
End If
BCC:
Application.Run MacroName:="BCC"
GoTo last
File:
WordBasic.FileSave
WordBasic.ChDefaultDir "d:\data\winword\data\temp\", 0
WordBasic.FileSaveAs Name:="FILE.DOC"
Selection.HomeKey Unit:=wdStory
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader
End If
Selection.WholeStory
Selection.Delete Unit:=wdCharacter, Count:=1
ChangeFileOpenDirectory "s:\legal\data\Templates\"
Selection.InsertFile FileName:="FCPY~FTR.DOT", Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Application.Run MacroName:="Printer_File"
GoTo last
Envelope:
Application.Run MacroName:="LabelorEnvelope"
last:
ActivePrinter = "\\FPSERVER\9103HP11"
End Sub
Print Options dialog box as specified in the macro. Instead I'm
getting a Save As dialog box which opens up the folder which I have
specified in TOOLS > OPTIONS > FILE LOCATIONS. When I click Cancel, I
get Run-time error '4198'. Any ideas????????????
We did a migration last nite and and made changes to normal.dot.
ActivePrinter was "\\LEGAL\LASERJET 4M" but has been changed to
"\\FPSERVER\9103HP11". Any ideas?
Public Sub Main()
Dim a
Dim z
Dim b
Dim bb
Dim c
Dim cc
Dim d
Dim dd
Dim e
Dim f
Dim p
Dim g
ActiveDocument.Save
ActiveDocument.Content.Select 'select all
ActiveDocument.Fields.Update
Selection.HomeKey Unit:=wdStory
Start:
WordBasic.BeginDialog 276, 275, "Print Options"
WordBasic.Text 10, 6, 245, 13, "Please Select Your Print Option ",
"Text1"
WordBasic.PushButton 10, 26, 255, 21, "&1 - Pleadings Bond",
"Push1"
WordBasic.PushButton 10, 51, 255, 21, "&2 - Letterhead", "Push2"
WordBasic.PushButton 10, 101, 120, 21, "&3 - BCC", "Push3"
WordBasic.PushButton 10, 76, 255, 21, "&4 - FaxPress", "Push4"
WordBasic.PushButton 145, 101, 120, 21, "&5 - Copy", "Push5"
WordBasic.PushButton 10, 126, 120, 21, "&6 - File Copy", "Push6"
WordBasic.PushButton 10, 151, 120, 21, "&7 - Manual Feed", "Push7"
WordBasic.PushButton 145, 126, 120, 21, "&8 - Draft", "Push8"
WordBasic.PushButton 145, 151, 120, 21, "&9 - Print", "Push9"
WordBasic.PushButton 10, 181, 255, 21, "&Envelope/Label", "Push10"
WordBasic.CancelButton 10, 215, 255, 46
WordBasic.EndDialog
Dim dlg As Object: Set dlg = WordBasic.CurValues.UserDialog
'Define the dialog record
a = WordBasic.Dialog.UserDialog(dlg) 'Display the dialog box
If a = 1 Then
GoTo Bond
ElseIf a = 2 Then
GoTo Legal
ElseIf a = 3 Then
GoTo BCC
ElseIf a = 4 Then
GoTo Fax
ElseIf a = 5 Then
Application.Run MacroName:="Copy.MAIN"
Application.Run MacroName:="Printer_Copy"
GoTo last
ElseIf a = 6 Then
GoTo File
ElseIf a = 7 Then
Manual:
Application.Run MacroName:="ManualFeed"
WordBasic.BeginDialog 420, 69, "Manual Feed Options"
WordBasic.Text 10, 6, 410, 13, "Do You Want to Print Additional
Manual Feed Copies?", "Text1"
WordBasic.PushButton 76, 25, 88, 21, "&Yes", "Push1"
WordBasic.PushButton 217, 25, 88, 21, "&No", "Push2"
WordBasic.EndDialog
Set dlg = WordBasic.CurValues.UserDialog
Set dlg = WordBasic.CurValues.UserDialog 'Define the dialog
record
z = WordBasic.Dialog.UserDialog(dlg) 'Display the dialog box
If z = 1 Then
GoTo Manual
ElseIf z = 2 Then
GoTo last
End If
ElseIf a = 8 Then
Application.Run MacroName:="Draft"
GoTo last
ElseIf a = 9 Then
Top:
Application.Run MacroName:="Printer"
WordBasic.BeginDialog 420, 69, "Additional Copies"
WordBasic.Text 10, 6, 410, 13, "Do You Want to Print Additional
Copies?", "Text1"
WordBasic.PushButton 76, 25, 88, 21, "&Yes", "Push1"
WordBasic.PushButton 217, 25, 88, 21, "&No", "Push2"
WordBasic.EndDialog
Set dlg = WordBasic.CurValues.UserDialog
Set dlg = WordBasic.CurValues.UserDialog 'Define the dialog
record
z = WordBasic.Dialog.UserDialog(dlg) 'Display the dialog box
If z = 1 Then
GoTo Top
ElseIf z = 2 Then
GoTo last
End If
ElseIf a = 10 Then
GoTo Envelope
Else
GoTo last
End If
Bond:
Application.Run MacroName:="Bond"
WordBasic.BeginDialog 420, 69, "Additional Copies"
WordBasic.Text 10, 6, 410, 13, "Do You Want to Print Additional
Copies?", "Text1"
WordBasic.PushButton 76, 25, 88, 21, "&Yes", "Push1"
WordBasic.PushButton 217, 25, 88, 21, "&No", "Push2"
WordBasic.EndDialog
Set dlg = WordBasic.CurValues.UserDialog
Set dlg = WordBasic.CurValues.UserDialog 'Define the dialog
record
z = WordBasic.Dialog.UserDialog(dlg) 'Display the dialog box
If z = 1 Then
GoTo Bond
ElseIf z = 2 Then
GoTo last
End If
Legal:
WordBasic.EndOfDocument
Application.Run MacroName:="Bond"
WordBasic.BeginDialog 293, 86, "BCC Information"
WordBasic.Text 10, 6, 272, 13, "Do You Want to Print a BCC
Copy?", "Text1"
WordBasic.PushButton 39, 23, 88, 21, "&Yes", "Push1"
WordBasic.PushButton 170, 24, 88, 21, "&No", "Push2"
WordBasic.CancelButton 111, 59, 88, 21
WordBasic.EndDialog
Set dlg = WordBasic.CurValues.UserDialog
Set Dlg1 = WordBasic.CurValues.UserDialog
Dim Dlg2 As Object: Set Dlg2 = WordBasic.CurValues.UserDialog
'Define the dialog record
c = WordBasic.Dialog.UserDialog(Dlg2) 'Display the dialog box
If c = 1 Then
Application.Run MacroName:="BCC"
GoTo last
ElseIf c = 2 Then
WordBasic.BeginDialog 293, 86, "File Copy Information"
WordBasic.Text 10, 6, 272, 13, "Do You Want to Print a File
Copy?", "Text1"
WordBasic.PushButton 39, 23, 88, 21, "&Yes", "Push1"
WordBasic.PushButton 170, 24, 88, 21, "&No", "Push2"
WordBasic.EndDialog
Set dlg = WordBasic.CurValues.UserDialog
Set Dlg1 = WordBasic.CurValues.UserDialog
Set Dlg2 = WordBasic.CurValues.UserDialog
Set dlg = WordBasic.CurValues.UserDialog 'Define the dialog
record
cc = WordBasic.Dialog.UserDialog(dlg) 'Display the dialog box
If cc = 1 Then
GoTo File
ElseIf cc = 2 Then
GoTo last
End If
End If
Fax:
Application.Run MacroName:="FaxPress"
WordBasic.BeginDialog 293, 86, "BCC Information"
WordBasic.Text 10, 6, 272, 13, "Do You Want to Print a BCC
Copy?", "Text1"
WordBasic.PushButton 39, 23, 88, 21, "&Yes", "Push1"
WordBasic.PushButton 170, 24, 88, 21, "&No", "Push2"
WordBasic.CancelButton 111, 59, 88, 21
WordBasic.EndDialog
Set dlg = WordBasic.CurValues.UserDialog
Set Dlg1 = WordBasic.CurValues.UserDialog
Set Dlg2 = WordBasic.CurValues.UserDialog
Dim Dlg3 As Object: Set Dlg3 = WordBasic.CurValues.UserDialog
'Define the dialog record
d = WordBasic.Dialog.UserDialog(Dlg3) 'Display the dialog box
If d = 1 Then
Application.Run MacroName:="BCC"
GoTo last
ElseIf d = 2 Then
WordBasic.BeginDialog 293, 86, "File Copy Information"
WordBasic.Text 10, 6, 272, 13, "Do You Want to Print a File
Copy?", "Text1"
WordBasic.PushButton 39, 23, 88, 21, "&Yes", "Push1"
WordBasic.PushButton 170, 24, 88, 21, "&No", "Push2"
WordBasic.EndDialog
Set dlg = WordBasic.CurValues.UserDialog
Set Dlg1 = WordBasic.CurValues.UserDialog
Set Dlg2 = WordBasic.CurValues.UserDialog
Set Dlg3 = WordBasic.CurValues.UserDialog
Set dlg = WordBasic.CurValues.UserDialog 'Define the dialog
record
dd = WordBasic.Dialog.UserDialog(dlg) 'Display the dialog box
If dd = 1 Then
GoTo File
ElseIf dd = 2 Then
GoTo last
End If
End If
BCC:
Application.Run MacroName:="BCC"
GoTo last
File:
WordBasic.FileSave
WordBasic.ChDefaultDir "d:\data\winword\data\temp\", 0
WordBasic.FileSaveAs Name:="FILE.DOC"
Selection.HomeKey Unit:=wdStory
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader
End If
Selection.WholeStory
Selection.Delete Unit:=wdCharacter, Count:=1
ChangeFileOpenDirectory "s:\legal\data\Templates\"
Selection.InsertFile FileName:="FCPY~FTR.DOT", Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Application.Run MacroName:="Printer_File"
GoTo last
Envelope:
Application.Run MacroName:="LabelorEnvelope"
last:
ActivePrinter = "\\FPSERVER\9103HP11"
End Sub