PDA

View Full Version : Automatic printing macro help?



dreagraham
11-04-2016, 06:10 AM
I was sent up to a job today in work where any files that are sent to a specific email account that includes an attachment are automatically moved to a different folder and printed (To save time as its the sales department). the print out is the email its self and the attachment. This was working fine although now it wont print out the attachment. I'm not very good with code, my boss had wrote what is shown below but even when i have applied it to my outlook (2016) it also only prints the email page and not the attachment.
VBA:
Sub myRuleMacro(item As Outlook.MailItem)
Dim FileN As String
FileN = "C:\script\script.bat"

Call Shell(FileN, 1)
End Sub

(I can't seem to be able to post the script)
I have ensured that in print options the print attachment box is ticked. I tried code from online which did work although it didn't work along with the rule created already and I'm not too sure how to actually set up the coding part because lets say its not my area. Setting up the rule its self is fine.

Any ideas?
Would be much appreciated!
:banghead::banghead:

gmayor
11-05-2016, 01:54 AM
"C:\script\script.bat" is a text file. Open it in Notepad and copy/paste the content.
I suspect the failure to print may be either that you have no application associated with the attachment(s) or it is hanging because of Outlook's security checks. The batch file may provide clues.

dreagraham
11-07-2016, 03:29 AM
Sorry to get back to you so late the post is being denied when i type in the script batch file. I'm not sure how to get it on here.

gmayor
11-07-2016, 05:07 AM
On the title bar of your reply you will see a hash symbol '#'. This inserts Code tags. Paste your code from Notepad between the tags.

dreagraham
11-07-2016, 05:13 AM
17524

gmayor
11-07-2016, 06:03 AM
That's not quite what I had in mind, but even though my DOS programming is a little rusty, that code has nothing to do with printing. Are you sure that's the content of "C:\script\script.bat"?
Rather than pursue this seemingly lost cause, I suggest you look at Michal Bauer's code at http://www.slipstick.com/developer/print-attachments-as-they-arrive/

dreagraham
11-07-2016, 06:42 AM
Yes this is definitely it, its set up with a rule on outlook that makes the email and attachment print out and move folder, this opens and closes the file on adobe so it can print as beforehand there were ridiculous amounts of pdf files open causing the machine to crash. I don't really know why my boss has worked this out in such an awkward way but i will have a look at that and see what I can do. I just suck at anything to do with coding.