Writing a macro in Outlook 2007

Hello -

I have been trying to create code in Outlook 2007 that will send an item to 
a specific printer. I realize there is no macro recorder in Outlook, and I am 
not a programmer, so I've been trying to manipulate code found on a Microsoft 
support page, without success.

Does anyone know the code required to send an item to a specific printer, 
other than the default? 

Here is a sample of what I've found - it includes resetting the default 
printer:

Sub MAIN
   'Retrieve and set information about the current default printer
   Dim FPS As FilePrintSetup
   GetCurValues FPS
   'Set the default Printer
   DefaultPrinter$ = FPS.Printer
   FilePrintSetup .Printer = "HP LaserJet IIISi on LPT1:"
   'Send the document to the currently selected printer
   FilePrint
   'Reset to the original default printer
   FilePrintSetup .Printer = DefaultPrinter$
End Sub


I changed the printer name to the printer I wanted to use, but am not sure 
how to define my default printer name.

I really do not even need to have the printer reset to the default, as I can 
add another button that will print to that specific printer, when needed.

Thanks for any help!

0
Tammy (89)
5/8/2007 1:56:03 PM
outlook 87536 articles. 10 followers. Follow

2 Replies
254 Views

Similar Articles

[PageSpeed] 15

Outlook has no objects that would allow you to direct output to a =
specific printer or change the default printer. You would have to reset =
the system default printer, as at =
http://support.microsoft.com/default.aspx?scid=3Dkb;en-us;266767

FYI, there is a newsgroup specifically for general Outlook programming =
issues "down the hall" at microsoft.public.outlook.program_vba or, via =
web interface, at =
http://www.microsoft.com/office/community/en-us/default.mspx?dg=3Dmicroso=
ft.public.outlook.program_vba
--=20
Sue Mosher, Outlook MVP
   Author of Configuring Microsoft Outlook 2003
     http://www.turtleflock.com/olconfig/index.htm
   and Microsoft Outlook Programming - Jumpstart for=20
     Administrators, Power Users, and Developers
     http://www.outlookcode.com/jumpstart.aspx
  =20
"Tammy" <Tammy@discussions.microsoft.com> wrote in message =
news:290153F1-04BB-4EDD-9253-98B38D551F58@microsoft.com...
> Hello -
>=20
> I have been trying to create code in Outlook 2007 that will send an =
item to=20
> a specific printer. I realize there is no macro recorder in Outlook, =
and I am=20
> not a programmer, so I've been trying to manipulate code found on a =
Microsoft=20
> support page, without success.
>=20
> Does anyone know the code required to send an item to a specific =
printer,=20
> other than the default?=20
>=20
> Here is a sample of what I've found - it includes resetting the =
default=20
> printer:
>=20
> Sub MAIN
>   'Retrieve and set information about the current default printer
>   Dim FPS As FilePrintSetup
>   GetCurValues FPS
>   'Set the default Printer
>   DefaultPrinter$ =3D FPS.Printer
>   FilePrintSetup .Printer =3D "HP LaserJet IIISi on LPT1:"
>   'Send the document to the currently selected printer
>   FilePrint
>   'Reset to the original default printer
>   FilePrintSetup .Printer =3D DefaultPrinter$
> End Sub
>=20
>=20
> I changed the printer name to the printer I wanted to use, but am not =
sure=20
> how to define my default printer name.
>=20
> I really do not even need to have the printer reset to the default, as =
I can=20
> add another button that will print to that specific printer, when =
needed.
>=20
> Thanks for any help!
>
0
suemvp (4039)
5/8/2007 2:13:59 PM
Thanks so much, Sue!

"Sue Mosher [MVP-Outlook]" wrote:

> Outlook has no objects that would allow you to direct output to a specific printer or change the default printer. You would have to reset the system default printer, as at http://support.microsoft.com/default.aspx?scid=kb;en-us;266767
> 
> FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.outlook.program_vba
> -- 
> Sue Mosher, Outlook MVP
>    Author of Configuring Microsoft Outlook 2003
>      http://www.turtleflock.com/olconfig/index.htm
>    and Microsoft Outlook Programming - Jumpstart for 
>      Administrators, Power Users, and Developers
>      http://www.outlookcode.com/jumpstart.aspx
>    
> "Tammy" <Tammy@discussions.microsoft.com> wrote in message news:290153F1-04BB-4EDD-9253-98B38D551F58@microsoft.com...
> > Hello -
> > 
> > I have been trying to create code in Outlook 2007 that will send an item to 
> > a specific printer. I realize there is no macro recorder in Outlook, and I am 
> > not a programmer, so I've been trying to manipulate code found on a Microsoft 
> > support page, without success.
> > 
> > Does anyone know the code required to send an item to a specific printer, 
> > other than the default? 
> > 
> > Here is a sample of what I've found - it includes resetting the default 
> > printer:
> > 
> > Sub MAIN
> >   'Retrieve and set information about the current default printer
> >   Dim FPS As FilePrintSetup
> >   GetCurValues FPS
> >   'Set the default Printer
> >   DefaultPrinter$ = FPS.Printer
> >   FilePrintSetup .Printer = "HP LaserJet IIISi on LPT1:"
> >   'Send the document to the currently selected printer
> >   FilePrint
> >   'Reset to the original default printer
> >   FilePrintSetup .Printer = DefaultPrinter$
> > End Sub
> > 
> > 
> > I changed the printer name to the printer I wanted to use, but am not sure 
> > how to define my default printer name.
> > 
> > I really do not even need to have the printer reset to the default, as I can 
> > add another button that will print to that specific printer, when needed.
> > 
> > Thanks for any help!
> >
> 
0
Tammy (89)
5/8/2007 2:47:00 PM
Reply:

Similar Artilces:

Help: Macro that runs various if statements, inserting rows etc
I am a newcomer to Macros and excel programming and was hoping someone could assist / provide the code to do the following: I have a +50,000 line spreadsheet, that needs to be formatted. Given the size I would like to automate this. There are 3 key formatting changes required and detailed below: n = 1 1. If Cell A(n) not equal Cell A(n+1) then insert a new row below A(n), make Cell F(insertedrow)=1, make Cell G(insertedrow)=A(n+1), make Cell H(insertedrow)=B(n+1) 2. If Cell C(n) not equal Cell C(n+1) then insert a new row below C(n), make Cell F(insertedrow)=2, make Cell G(inserte...

Deleting shortcut key In Recording new Macros dialog box
I have recorded several new Macros and I am running out of shortcut key letters to put into the shortcut key box within the Record a new Macro dialog box. How could I delete the shortcut keys that I have already used to reuse again to record new Macros? One way: Choose Tools/Macro/Macros... Select a macro for which you want to delete the shortcut. Click Options... Clear the shortcut key input box. Click OK, then Cancel. In article <9DC795B4-1EBE-4685-94DF-CD79ABEAF45D@microsoft.com>, John <John@discussions.microsoft.com> wrote: > I have recorded several new Macros ...

Outlook 2007 Calendar: Private by default
I ran into a scenario where a user was running Outlook 2007, and needed every appointment to be marked as Private by default. Because the form differs so much between Outlook 2003 and 2007, Microsoft's published instructions (http://office.microsoft.com/en-us/outlook/HA011456981033.aspx) do not apply at all to Outlook 2007. I had to figure this out on my own. Here is the procedure in case anyone out there needs this functionality: Outlook 2007: 1) Tools >> Forms >> Design A Form 2) Select Appointment, click Open 3) When the Form Designer comes up, look in the (All Fields...

Is there a way for Windows Service to Read/Write HKCU Reg key ?
Hi: I'm writing a Windows Service program which needs to read/write the HKEY_CURRENT_USER registry key for the current logged on user. I know that for a Windows service does not have concept of HKCU since it is always running in SYSTEM's context. But is there a way (trick?) for a service to access the HKCU registry key? Thanks In Advance ! Polaris Hello Try, from a user application (the one that is logged on, or the current user), to send the services the user's SID. Then access the HKCU through HKEY_USERS\users_sid\............ Hope that helps, Elias "Polaris&qu...

Macro Help- combining "CS" files
Below is the macro I have to go to a certain file and combine all spreadsheets. I did not write this macro myself. I just received it and modified it to work for my situation. When this maco is run it gets to the first file and says I cannot change a read only file and says I must unprotect the worksheet. This sheet is not protected but I really only want to copy the info on it anyway. Is there a way to modify this macro to copy the information. I could save all of the "CS" files as new files but that would defeat the purpose of automating this job Any help is greatly a...

wrong received times in outlook
I have two systems running Outlook 2002 that will show a received time two hours prior to the time that the messages was actually received. An email is received at say 10:30 am and it will show a received time of 8:30 am in the outlook window. There is only one time zone set up by default when the software was installed. Any fixes? ...

How to link Excel deadline dates to Outlook?
Need to link dates to Outlook users in either email or tasks, for purpose of task reminders and to track completion of task. ...

Contacts in outlook...
I had to wipe out & re-install everything on Dad's computer. When creating a new email & I hit the "To" button, the contacts aren't showing up. How do I fix this? Thanks- 1. Make sure the Contact folder is enabled as an email address book, right click the folder choose Properties and Outlook Address Book ensure checkbox to enable as email address book is checked; if this is dimmed or greyed then go on to No.2 2. Go to Tools > Email Accounts > check "View or change existing directories or address books" > is the Outlook Address Book prese...

Outlook Send/Receive problems when separating imap.pst from default location
We are having a problem when using Outlook 2002 upgraded from 2000. Using IMAP as the only mail account the Send/Receive button no longer works (for some users - not all users). I know all about the default local folder (Outlook Today) Inbox issues having to be the default but this one is that it won't automatically check for message and the Send/Receive button doesn't work when splitting out the email.pst file (again this only affects some users). This happens when we separate out the email.pst file from the default Documents and Settings folder. We didn't want all the cached ...

Excel Macro #2
I need to create an Excel Macro tha will import a series of txt files, one below the other, automatically. The macro will be run every two weeks and each txt file will have additional rows. What I want to know is how to automatically position the curson to the next open cell in column A after the previous txt file was imported. Can anyone help? Range("A1").Offset(ActiveSheet.UsedRange.Rows.Count, 0).Select Dan E "Robert Blankenhorn" <Blankenhorn.B@cpcnet.co.richland.oh.us> wrote in message news:05ab01c35dc3$99bb7130$a001280a@phx.gbl... > I need to creat...

Write
I am trying to change the default margins. I am requested to use the Write mode to do this. What is Write, and how do I access it? Are you using voice recognition? Margins are simply changed in the Arrange Menu in Publisher. Are you in the right newsgroup? -- Mary Sauer MS MVP http://office.microsoft.com/ http://www.mvps.org/msauer/ news://msnews.microsoft.com "CBC" <anonymous@discussions.microsoft.com> wrote in message news:183bb01c44a40$107bd5d0$a501280a@phx.gbl... > I am trying to change the default margins. I am requested > to use the Write mode to do this. W...

Writing formula for excel worksheet
Item Rate1 Rate2 Rate3 A 3 4 6 B 8 5 23 C 56 5 78 Above is my excel sheet. I want to write some formula so that in every row cell having minimum rate should come bold. Like For Item A - Rate1(3) for Item B - Rate2(5) For Item C - Rate2 (5) There may be a neater way but this works. Somewhere in you sheet in a cell type =min(A1:a4), I used L1 Change this to watever range you are trying to evaluate. Then select this range and click format - conditional format - cell value - is equal to =($L$1) and apply your bold font. The lowest value in the range will then become bold. Mike "Gaur...

Access 2007 Runtime on Machine With Older Version?
A client of mine likes some of the new bells and whistles in Access 2007, and is thinking about converting our A03 format MDB to an A07 format file. However, while some of the users have A07, many do not, and it's not clear when they would get it. His thought was to use the upcoming Access 2007 runtime to allow the users who are still running Office 2003 to be able to run the database. While I use multiple versions of Access on my development machine, I advised him against this, as I recall from years ago with the Access 97 runtime that it caused problems when run on a machine that...

Keyboard Macro Just Copies Content of Previous Cell
I created a simple keyboard macro to edit the contents of a cell by simply inserting a "b" in a particular position. For example, I have a series of alphanumeric numbers that start with S1253, e.g., S12536675. I wanted to insert a "b" after the first five digits on the left to revise the series of alphanumeric numbers to start with S1253b, e.g..S1253b6675. However, after creating the keyboard macro, when I run the macro on the next cell to be edited (i.e., S12536676), the macro simply copies the contents of the original cell that I edited when I first created the ...

Outlook 2003 Errors sending emails
I am getting error message when sending emails. This happans since I have installed the new outlook 2003. I am getting the following error message: The following recipient(s) could not be reached: 'pdegeus@mns.com' on 22-Dec-03 9:44 PM 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1) Any idea what this is Maybe check spelling MSN instead of MNS? "pdegeus@msn.com" <anonymous@discussions.microsoft.com> wrote in message news:<056901c3c8ff$d83455b0$a101280a@phx.gbl>... > I am getting error message when sending emai...

write protect/write redirect/kios mode
Hey, I LOVE snapshots in virtualmachines and think it would be awesome to have something like this for my main windows install. Anyone know of any hardware/software to redirect writes to another drive/file/memory/hardware? Or hardware to write protect a drive for kios's (i found some once befor the reverted all changes on shutdown, but cant find it anymore ><) I know VSS(virtual shadow copy service) has a function to redirect on write and wondering if i might be able to use that :/ It will just make everything cleaner, and give alot of flexiblity to setting up ...

EXCEL 2003/2007
I want to enter data in a cell in sheet1, data entered will accumulated in sheet2 every time I save. Thus, a summary table is created in sheet2. Is this possible in MS Excel? How will I do it? I would appreciate it the answer to this query is also emailed to me at giovannierualo@yahoo.com. Yes, that is possible. But you have to provide more detail about what you want. You say that you will be entering data into ONE cell in sheet1. Will that always be the same cell? If so, what cell? Then you say you want this data to be "accumulated" in sheet2. Exactly how d...

INserting Word Docs into E mail Outlook 2007
Want to be able to ijsert a formatted Word into the body of an E mail. ...

Outlook hanging on ADSL
We are experiencing this issue at work. Just to give you an overview of the setup we have; we connect to an exchange server using outlook as the email client, to connect to the corporate network we are using ADSL and going through the Nortel VPN client. Anyone got any ideas why this may be occurring, settings to check etc? More info on your network might help. You're in a remote office, using VPN to connect to the main office where the Exchange server lives? Any reason you can't just set up a VPN WAN link between the two networks rather than using individual client software (whi...

Slow down SendKeys macro
Hello, I have a macro that sends several sendkey commands to modify some settings within a printer's print settings dialog box. The problem is that the macro seems to be too fast for the application at times, and the keys are sent before the application is at the place it needs to be. If I print the macro and key the sequence in by hand it works perfectly. I would like to add a quarter second delay between all the keys that are pressed in the sequence if possible. I've examined some loop commands, but they have resulted in much more agony than help. Any idea on how to keep the macro...

Outlook/Exchange sync issues
When implementing CRM 3.0 we discovered a potential problem with sync issues where the users Outlook is trying to retreive appointment he/she is not a member of. This results in aprox 3 error per minute/user in Sync Issues and Local Failures folders in Outlook. (it has nothing to do with syncronizing of CRM data) Microsoft provided a hotfix KB933099, for this and the problem was gone. Now when having upgraded to CRM 4.0, we have exactly the same situation again. 2-3000 errors per user a day!!! With exactly the same issue. Doesn't MS correct discovered bugs in older products when de...

Cannot open .msg files saved from Outlook to network share
Some of my users have dragged and dropped emails into their network shares creating .msg files. When they try to open some of the files they get the following popup: 'The messaging interface has generated an unknown error. If the problem persists, restart Outlook.' This only happens for some of the saved emails. They are using Outlook 2000 from Office. God only knows why they did this and didn't use autoarchive! How many training sessions does someone have to do?! Anyway, anyone know how I can open them or even better, why I cant? Regards Dave ...

Set up email accout in Outlook 2003
I'm using cox high-speed internet and want to use Outlook 2003 to view my email. How do I do this? do you have outlook configured to receive email from cox high speed or have alread done this? "Karen" <Karen@discussions.microsoft.com> wrote in message news:6D86EB69-B86B-4A1A-808E-79AE12FA833F@microsoft.com... > I'm using cox high-speed internet and want to use Outlook 2003 to view my > email. How do I do this? Follow the instructions your ISP provides. This is not an Outlook question. -- Russ Valentine [MVP-Outlook] "Karen" <Karen@discussi...

Cannot write to memory location
I can not (all of the sudden) run Publisher in the last week. When starting to run it, I get that it cannot write to a certain memory locaiton, so it is shutting down. I need to get this program working. I have read through this forum and tried the different fixes as well as the knowledge base (emptied the temp file, disabled anti-virus, etc.) but it still won't work. An example is: "The instruction at "0x77f585c0" referenced memory at "0x00000000". the memory could not be "written". Click on OK to terminate the program." The header read...

enable Macro
I have a word document with several macros . I have to enable them every time i use the word doc is there a way i can stop the enable pop up without lowering the security settings. any help would be great thanks phill --- Message posted from http://www.ExcelForum.com/ Phil This is an Excel News Group, but check out Help in Word under Answer Wizard and "certificates". Check out "create self-signed certificates" using the SELFCERT feature of MS Office. Same for Excel and Word. Gord Dibben Excel MVP On Mon, 23 Aug 2004 18:45:36 -0500, philthedil <<philthedil.1b...