Results 1 to 3 of 3
  1. #1
    ksor's Avatar
    ksor is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Feb 2017
    Posts
    126

    Running a macro in Excel from Access gives error 1004

    I have some working macros in Excel - and they work when tested in Excel !



    I want to call them from Access ... and all the setting up of the "connection" to the open Excel workbook IS working too !

    How come I can't run the macros from Access - here is a snipet of my code:

    HTML Code:
     
       Set myRec = F.Recordset
        myRec.MoveFirst
        Teller = 1
        While Not myRec.EOF
            With myRec
                objexcel.Run "visEnPerson", .Fields("PersonID"), _
                                            .Fields("Køn"), _
                                            HentFMENavn(.Fields("PersonID")), _
                                            .Fields("Fødselsdato"), _
                                            .Fields("Fødested"), _
                                            .Fields("Dødsdato"), _
                                            .Fields("Dødssted")
            End With
            
            objexcel.Run "flytPerson", myRec.Fields("PersonID"), 1, "D"
            
            Teller = Teller + 1
            myRec.MoveNext
        Wend
    What am I missing here ?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    do the excel permissions allow macros to be run ? (esp from outside source)

  3. #3
    ksor's Avatar
    ksor is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Feb 2017
    Posts
    126
    I in fact had some issues with NULL-values transferred to (or tried to) transfere them to the macro ... and THAT's nor allowed !

    So problem solved now

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

Similar Threads

  1. Replies: 2
    Last Post: 04-27-2017, 11:59 AM
  2. Running excel macro from access error
    By didiomm in forum Programming
    Replies: 2
    Last Post: 04-28-2016, 10:47 AM
  3. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  4. Running excel macro's from withing Access
    By zippy483 in forum Programming
    Replies: 5
    Last Post: 03-08-2011, 11:47 AM
  5. Running excel macro from access
    By timpepu in forum Programming
    Replies: 1
    Last Post: 02-26-2010, 11:32 PM

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