Solved

Rune macro in Excel from Access

Posted on 2014-03-12
2
319 Views
Last Modified: 2014-03-12
HI,
I am trying to run a macro in an Excel workbook from within Access, using a button on an Access form. Can someone help me in finding out why the following code doesn't work?
'set variables to open Excel
    Dim objXL As Excel.Application
    Dim objWkb As Excel.Workbook
    Dim objSht As Excel.Worksheet
    Dim strFileName As String

strFileName = (GetMyPath() & "Interface2.xlsm")
    Set objXL = New Excel.Application
    With objXL
        Set objWkb = .Workbooks.Open(strFileName, , False, , "thisisthepassword")
                For Each objSht In objWkb.Worksheets
                    objSht.Visible = xlSheetVisible
                Next objSht
                objWkb.Run "Upload2Dbase"
        Set objSht = objWkb.Worksheets("SageDump")
        .Visible = True
        AppActivate objXL.Caption
        objSht.Activate
     End With
     
    'destroy objects
    Set objSht = Nothing
    Set objWkb = Nothing
    Set objXL = Nothing

Open in new window

The error I get is that the Object doesn't support this property or method.
I have searched google and this site for pointers but I'm at a loss.
0
Comment
Question by:Stephen Byrom
2 Comments
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39923701
Hi,

ps try

objXL.Run "Upload2Dbase"

Open in new window

Regards
0
 
LVL 1

Author Closing Comment

by:Stephen Byrom
ID: 39923711
Beautifully simple.
Thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question