Consulting

Results 1 to 8 of 8

Thread: Send as Attachment - Change coding from Excel 2003 to Excel 97

  1. #1

    Send as Attachment - Change coding from Excel 2003 to Excel 97

    I ened up writing all of my coding using Excel 2003. Everything was working perfectly. Then I tried using my program on a user computer. PROBLEM! The end-user computers only have Excel 97. Now I'm stuck.....I'm trying to send my active workbook as an Outlook e-mail attachment (to multiple recipients):
    [vba]'Create and show the outlook mail item
    Set oApp = CreateObject("Outlook.Application")
    Set oMail = oApp.CreateItem(0)
    With oMail
    .To = "Scheduling; Pressroom Manager; Pressroom Engineer"
    .Subject = "Pressroom Pulled Job Ticket"
    .Attachments.Add ActiveWorkbook.FullName
    .Display
    End With[/vba]

    Also, I have this code used during another step in the process (haven't tested it on the end-user Ecel 97 computers yet):
    [vba]'Create and show the outlook mail item
    Set oApp = CreateObject("Outlook.Application")
    Set oMail = oApp.CreateItem(0)
    With oMail
    .To = "Supervisor1; Supervisor2; Supervisor3"
    '.CC = ""
    .Subject = "Verify Pressroom Pulled Job Counts"
    .HTMLBody = "A pull ticket has been submitted. Please check the <a href=""V:\press\Forum\Count Control\Pull Tickets\Verification Needed\"">Verification Needed</a> folder."
    .Importance = 2
    .Display
    End With[/vba]

    I'm SO close to getting this project completed....just need to get it "97 friendly"

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Have you set a reference to Outlook in the project?

  3. #3
    This is what I have for the email with a hyperlink:
    [vba]Private Sub Submit_Ticket_Click()
    Dim oApp As Object
    Dim oMail As Object

    'Create and show the outlook mail item
    Set oApp = CreateObject("Outlook.Application")
    Set oMail = oApp.CreateItem(0)
    With oMail
    .To = "Supervisor1; Supervisor2; Supervisor3"
    '.CC = ""
    .Subject = "Verify Pressroom Pulled Job Counts"
    .HTMLBody = "A pull ticket has been submitted. Please check the <a href=""V:\press\Forum\Count Control\Pull Tickets\Verification Needed\"">Verification Needed</a> folder."
    .Importance = 2
    .Display
    End With

    'Restore screen updating and release Outlook
    Application.ScreenUpdating = True
    Set oMail = Nothing
    Set oApp = Nothing

    End Sub[/vba]

    And this is what I have for the attachment email:
    [vba]Private Sub OK_Button_Click()
    Dim oApp As Object
    Dim oMail As Object
    'Create and show the outlook mail item
    Set oApp = CreateObject("Outlook.Application")
    Set oMail = oApp.CreateItem(0)
    With oMail
    .To = "Scheduling; Pressroom Manager; Pressroom Engineer"
    .Subject = "Pressroom Pulled Job Ticket"
    .Attachments.Add ActiveWorkbook.FullName
    .Display
    End With
    'Restore screen updating and release Outlook
    Application.ScreenUpdating = True
    Set oMail = Nothing
    Set oApp = Nothing
    [/vba]

    It crashed when I reached
    [vba]Set oApp = CreateObject("Outlook.Application") [/vba]

  4. #4
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    It crashed when I reached
    Fair enough, but would you care to share the exact error message you get? And have you checked that you have a reference set to Outlook as xld asked?
    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





  5. #5
    I'm sorry for not posting the error. I was only just able to get back on the Excel 97 computer this morning. I am getting "Run-time error '429': ActiveX component can't create object".

    Also, I'm not sure what you mean by setting a reference to Outlook. Is this something specific to my workbook or is it Excel in general?

    So frustrating Like I said, everything worked perfectly on my computer.......

  6. #6
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    Sorry, feathers...

    Your code is late bound, so references aren't required. That was a red herring.

    I found the following article on Microsoft's site that may be of use: http://support.microsoft.com/kb/q244264/
    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    No it isn't, because if ihe has set the reference, then using on an eralier version will still produce an error trying to resolve the reference.

  8. #8
    I tried out my coding using another computer with Excel 97 and didn't appear to have any problems with creating the email with attachment. Ken, I will try to check out things in the article when I get a chance to get on the other computer that was causing me all of my problems.

Posting Permissions

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