Complicated Macro (idiot's guide)

CraigFord

New Member
Joined
Sep 5, 2011
Messages
39
Afternoon

new to this forum and very new to macros

im looking for a macro do do something very specific (it may not be possable)

i have an excel workbook which has 2 tabs
it is saved in a file on a server
file name is in E5

im looking for 2 individual macros

1) Save_Email (save and print)
2) Save_Print (save and email)

these will be two buttons that my engineers can choose which one to select.

the save function should save the document as a pdf into the same file as the workbook and the file name should be as E5

the email function should open up the window that allows it to be emaild as a PDF attachment

the print function should open up the print box

i dont even know if this is possable, if it is please help.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Do you intend to do this through microsoft outlook?

If so you will need to reference the "Microsoft Outlook 12.0 Object Library".

Have a look at...

HTML:
http://www.outlookcode.com/article.aspx?ID=40
 
Upvote 0


i was hoping to do it through excel's own PDF converter, we have lots of people working off different machines.

i can make it export to PDF & save using the macro record function, the result is below, however i cant make this add a cell refrence as the PDF name.

Sub Macro2()
'
' Macro2 Macro
'

'
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\craigford\Desktop\101009891.pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,3,,,TRUE,,FALSE)"
End Sub
 
Upvote 0
Code:
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\craigford\Desktop\" & Cells(5,5).Value & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,3,,,TRUE,,FALSE)"
End Sub

This will save onto your desktop, you can change the save directory as you see fit.
 
Upvote 0
Code:
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\craigford\Desktop\" & Cells(5,5).Value & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,3,,,TRUE,,FALSE)"
End Sub
This will save onto your desktop, you can change the save directory as you see fit.

this works perfectly, however when i save and close the document, the macro dosent work,
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,285
Members
452,902
Latest member
Knuddeluff

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