Results 1 to 5 of 5

Calling a macro in a protected workbook

Threaded View

  1. #1
    Registered User
    Join Date
    02-04-2015
    Location
    Birmingham, England
    MS-Off Ver
    2010
    Posts
    3

    Calling a macro in a protected workbook

    I've been asked to do some work to automate a lengthy manual process. My client has to send some data every week, in a .xls file which is based on a template (unfortunate choice of term, it's not an Excel 'template') provided by the organization to which the data has to be returned.

    This template contains macros, is password-protected (no, they won't tell me the password!) and the project is locked for viewing/editing.

    I'm constrained to using VB6 to write my automation application. Some cells in the workbook are not locked, and my VB app is able to write data into those cells without any fuss. There are two data items which I can't write into cells directly. There are two command buttons on one of the sheets in the workbook, and clicking either of the buttons causes a dialog to be displayed, which allows me to enter one of those two data items. So, my plan is for the application to call the macro which displays the dialog, then use SendKeys to populate and dismiss the dialog. All OK so far. I know what the two macros are named, because if I open the workbook manually, I can see the list of macros, and I can run them the usual way.

    My VB application contains the code
    oExcelApp.Application.Run strWorkbookName & "!ChooseOrg_Click"
    When this code executes, I get the error

    Run-time error '1004':

    Cannot run the macro 'RTT_PTL2_v1.1
    20150201.xls!ChooseOrg_Click'. The macro may not be available in
    this workbook or all macros may be disabled.

    Well, I know that both of those suggestions are false, but I need to know if I can find a way to run the macro. I'd be grateful for any assistance.
    Last edited by GJChurchward; 02-05-2015 at 07:45 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. calling an event macro from a different workbook
    By cwchan220 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-25-2014, 10:32 AM
  2. Calling Macro on Closing of Workbook
    By Dirigo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-26-2011, 02:57 PM
  3. Calling a Macro From a diffrent workbook
    By tzahi in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-20-2011, 03:27 AM
  4. Calling macro in another workbook
    By scabral in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-23-2009, 02:03 PM
  5. Calling Macro From Different Workbook
    By Launchnet in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-23-2008, 07:03 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1