Re: Saving a single worksheet

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Use only this line in the click event

Call MacroName


Also, if I use display under the lines for OutMail will it stop at the point where I will have to push the send button for the message to go?

Correct
Download the example workbook from my site and you will see it

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Shawn" <Shawn@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:AFC93654-73CD-4408-8CC4-AA175AEB1A29@xxxxxxxxxxxxxxxx
Ron,
I used the script for Mil one sheet in Outlook object model (attachment). I am trying to apply this macro to a command button in the sheet. The command button applies: Private Sub CommandButton1_Click()
Which is expecting and End command. If I delete that nothing happens when I try the button. What should I do? Also, if I use display under the lines for OutMail will it stop at the point where I will have to push the send button for the message to go?
With OutMail
.To = "mark.maycock@xxxxxxxxxxxxxxx"
.CC = "Central Lab"
'.BCC = ""
.Subject = "Central Lab Weekly WIG Update"
.Body = "Weekly WIG Update"
.Attachments.Add Destwb.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
"Ron de Bruin" wrote:

Hi Shawn

See
http://www.rondebruin.nl/sendmail.htm




Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Shawn" <Shawn@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:B30EC482-1FED-4D84-A27C-E14C46BC0DF6@xxxxxxxxxxxxxxxx
>I am trying to ise a command button to save a single worksheet from a > workbook to export to outlook and mail it. So far I have the following which > works fine but mails the whole workbook. My code is not good so details are > appreciated.
> Private Sub CommandButton1_Click()
> '
> '' Email Sheet
> ' Taken from Dustin's timesheet macro
> ' 1/28/08
> '
> > Dim Fname
> Fname = ActiveSheet.Name
> > Range("A1:N41").Select
> Selection.Copy
> 'Sheets.Add
> Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
> xlNone, SkipBlanks:=False, Transpose:=False
> ActiveWindow.DisplayGridlines = False 'added
> Application.CutCopyMode = False 'added
> Application.StandardFont = "Tahoma"
> Application.StandardFontSize = "10"
> Application.CutCopyMode = False
> Selection.Copy
> Application.CutCopyMode = False
> Selection.Copy
> Application.CutCopyMode = False
> Selection.Copy
> ActiveSheet.Paste
> With ActiveSheet.PageSetup
> .TopMargin = Application.InchesToPoints(0.5)
> .BottomMargin = Application.InchesToPoints(0.25)
> End With
> ChDir "C:\"
> Application.DisplayAlerts = False
> ActiveWorkbook.SaveAs Filename:="C:\SHD_current_week.xls", FileFormat:= _
> xlNormal, Password:="", WriteResPassword:="", > ReadOnlyRecommended:=False _
> , CreateBackup:=False
> Application.DisplayAlerts = True
> Application.Dialogs(xlDialogSendMail).Show
> End Sub
> >

.



Relevant Pages

  • Re: VBA code ok in Excel 2003, but crashes Excel 2002 & 2000
    ... for any routine that will lead to changing the active sheet. ... or Down Arrow to get onto the command button. ... Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ... Dim bBackwards, bForwards As Boolean ...
    (microsoft.public.excel.programming)
  • RE: using colour
    ... Now if you go to the properties of each of these command buttons, ... Any time you change selection on the sheet, it stores the address of the ... selected cell into cell L1. ... Private Sub Worksheet_SelectionChange ...
    (microsoft.public.excel.worksheet.functions)
  • RE: Command Button Problem
    ... Thanks once again Mike. ... inserting new command buttons but still same error is comming up. ... Private Sub CommandButton9_Click ... sheet that has these buttons on. ...
    (microsoft.public.excel.misc)
  • Re: Universal CommandButtons Accross Worksheets
    ... Private Sub Workbook_Deactivate ... try to use the commands it automatically opens the original workbook. ... Right now I have six command buttons and 485 lines of code for Just One ... buttons into everyworks sheet and then configure every button like this... ...
    (microsoft.public.excel.programming)
  • Re: disable pushbutton on spreadsheet
    ... push button on top of my sheet which has the caption of "Button 1". ... Private Sub CommandButton2_Click ...
    (microsoft.public.excel.programming)