Results 1 to 2 of 2
  1. #1
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480

    Run Access code, from separate excel...

    I am trying to run code that is stored in an access database FROM an excel spreadsheet. I don't need any information returned into excel from access... I am looking around online and finding A LOT of solutions.. but nothing is working.






    Location of .mde where the Code below resides...

    " C:\Program Files\LIFT\LIFT.mde "



    Code:
     Sub CreateHTMLMail()
            ''''Creates a new e-mail item and modifies its properties'
    
    
        Dim olApp As Outlook.Application
        Dim objMail As Outlook.MailItem
        Set olApp = Outlook.Application
        'Create e-mail item'
        Set objMail = olApp.CreateItem(olMailItem)
        Dim oServMan As InternetExplorer
        Dim Client, aClient, ClientNum, probloc, SMmail, Sum, Desc, SD As String
        Dim iQLS As Long
       
        Set oServMan = GetServMan
        Set otest = New clsSmselect
    
    
        otest.SMselect oServMan
     
        Set oServMan = GetServMan
      
            Client = otest.Client
            probloc = otest.probloc
            SMmail = otest.SMmail
            Sum = otest.Sum
            Desc = otest.Desc
            SD = otest.SD
     
        Set oServMan = Nothing
              ''' Assigning things above in outlook mail message.
          With objMail
            .Subject = Client & " / " & Sum & " / " & SD
            .Body = "Ticket Notes: " & Desc
            .To = SMmail
            .Display
            .ReadReceiptRequested = True
          End With
      End Sub

  2. #2
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480
    UPDATE :

    I found this code...

    Code:
    Public Sub ProcedureInAccess()
    
    
    Dim acApp As Object
    Dim db As Object
    Set acApp = CreateObject("Access.Application")
    acApp.OpenCurrentDatabase ("C:\Program Files\LIFT\LIFT.mde")
    Set db = acApp
    acApp.Run "CreateHTMLMail()"
    acApp.Quit
    Set acApp = Nothing
    End Sub
    It is opening the database, then excel gives me an error saying...

    Run-Time error '2517'
    Application-defined of object-defined error.

    Looking into this issue now.


    ----------------------

    Figured it out.... the () on the sub caused the error.
    Last edited by redbull; 10-16-2012 at 08:51 AM. Reason: Fixed

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 06-06-2012, 01:04 PM
  2. Replies: 1
    Last Post: 05-01-2012, 03:52 AM
  3. Combining separate excel report data
    By mikebravo in forum Import/Export Data
    Replies: 7
    Last Post: 04-16-2012, 01:16 PM
  4. Replies: 1
    Last Post: 08-12-2010, 10:04 PM
  5. Code to Update Excel from Access
    By portmancp in forum Programming
    Replies: 2
    Last Post: 03-10-2010, 03:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums