VBA code change from Office 2003 to 2010

lopaka

New Member
Joined
Nov 11, 2011
Messages
3
Hi, I am a newbie here and looking for some help.We just changed from office 2003 to 2010 and a print macro we use no longer functions. the print button when used is to bring up a balloon that offers the person a selection of 5 different printers to choose from. this will in turn print to the selected printer. Now that we have gone to office 2010 it will not run. I get a Microsoft Visual Basic run time error "91" I am assuming the code has been changed as how a balloon function works and I do not know what the new code is. Does anyone have an idea how to make this work again????
Here is the code:
Set b = Assistant.NewBalloon
With b
.Heading = "Printer Selection" Here is where the code errors
.Text = "Please select a printer."
.Labels(1).Text = "MTBE Control Room CXO086"
.Labels(2).Text = "DeepWell Printer CXO115"
.Labels(3).Text = "Nancy's Printer CXO077"
.Labels(4).Text = "Nancy's Copier/Printer CXO072"
.Labels(5).Text = "User Selectable Printer"

ReturnValue = .Show

End With
'MsgBox ("ReturnValue:") & ReturnValue
Select Case ReturnValue
Case 1 '"MTBE Control Room Printer"

Desired_Printer = "\\CXOFS01\CXO086"
'MsgBox ("Desired_Printer:") & Desired_Printer
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:=Desired_Printer, Collate:=True

Case 2 '"DeepWell Printer"

Desired_Printer = "\\CXOFS01\CXO115"
'MsgBox ("Desired_Printer:") & Desired_Printer
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:=Desired_Printer, Collate:=True

Case 3 '"Nancy's Printer CXO077"

Desired_Printer = "\\cxofs02\CXO077"
'MsgBox ("Desired_Printer:") & Desired_Printer
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:=Desired_Printer, Collate:=True

Case 4 '"Nancy's Copier/Printer CXO072"

Desired_Printer = "\\cxofs01\CXO072"
'MsgBox ("Desired_Printer:") & Desired_Printer
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:=Desired_Printer, Collate:=True

Case 5 '"Default"

'Desired_Printer = Application.ActivePrinter
'MsgBox ("Desired_Printer:") & Desired_Printer
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Application.SendKeys ("^(p)")

End Select
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,203,625
Messages
6,056,384
Members
444,862
Latest member
more_resource23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top