Solved

Rune macro in Excel from Access

Posted on 2014-03-12
2
316 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 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
Comment Utility
Hi,

ps try

objXL.Run "Upload2Dbase"

Open in new window

Regards
0
 
LVL 1

Author Closing Comment

by:Stephen Byrom
Comment Utility
Beautifully simple.
Thanks
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now