Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Trenton, Ontario
    Posts
    175
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro Not Running (2000)

    What I am trying to do with the code below is to, when the workbook is opened, it will update the linked cells, copy and paste just the values, email it as attachement and then close without saving. I'm not sure of the terminoligy, but I created the macro by right clicking on the Sheet1 tab and typing it in there.
    The problem is that macro does not run at all when the file is opened, the workbook opens fine but nothing after that.

    Private Sub Workbook_Open()
    ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources
    Range("A1:E21").Select
    Selection.Copy
    Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
    False, Transpose:=False
    Application.Dialogs(xlDialogSendMail).Show
    Dim objOLook As New Outlook.Application
    Dim objMail As MailItem
    Set objOLook = New Outlook.Application
    Set objOMail = objOLook.CreateItem(olMailItem)
    With objOMail
    .To = "David Driscoll"
    .Subject = "Production Report"
    .Attachements.Add ActiveWorkbook.FullName
    End With
    Set objOMail = Nothing
    SetobjOLook = Nothing
    ActiveWindow.Close
    End Sub

    Any help would be appreciated.
    Stats

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Macro Not Running (2000)

    The code has to be in the ThisWorkbook Object, not a Sheet Object.
    -John ... I float in liquid gardens
    UTC -7ąDS

  3. #3
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Macro Not Running (2000)

    Is the macro in the "thisWorkbook" object?

    Steve

  4. #4
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Trenton, Ontario
    Posts
    175
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Not Running (2000)

    It is not there, but I'll put it there now!!
    Thanks for your help.

    Stats

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •