Results 1 to 2 of 2

Thread: Sendmail problems

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2004
    Posts
    3

    Question Sendmail problems

    I have developed an Order Sheet in Excel XP which uses ActiveWorkbook.Sendmail to enable the order form to be emailed to a supplier, however when I have sent this spreadsheet out to the sales managers, who use Excel 97 on their machines, they are receiving an runtime error message 1004 "Method 'SendMail' of object '_Worksheet' failed."

    What makes it more peculiar is that the sales managers already have a spreadsheet which sends out emails of their Sales Logs using the Sendmail method, which works fine. However, this spreadsheet was developed in Excel 97 as opposed to Excel XP.

    Any ideas as to how to correct this problem? Is it to do with the different versions, and would a solution be to save the spreadsheet as an Excel 97 one?

    Any help will be appreciated.

    Regards,

    Barella

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Sendmail problems

    Yes, it is because they are using an older version then yours. Either use the
    same version or use ShellExecute API code to invoke a new email using the
    default email client.

    VB Code:
    1. 'VB6 Example
    2. Option Explicit
    3.  
    4. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
    5. ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    6.  
    7. Private Const SW_SHOWNORMAL As Long = 1
    8.  
    9. Private Sub Command1_Click()
    10.     'Use Application.hWnd when using with Excel instead of Me.hwnd
    11.     ShellExecute Me.hwnd, "Open", "mailto:[email protected]?subject=Email Test&Body=This is the body.", vbNullString, "C:\", SW_SHOWNORMAL
    12. End Sub
    HTH
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

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



Click Here to Expand Forum to Full Width