Excel Runtime Error 1004 Cannot Run The Macro
Contents |
Forums Excel Questions Run Time 1004 error when calling sub from another macro Page 1 of 4 123 ... Last Jump to page: Results 1 to 10 of runtime error 1004 cannot run the macro the macro may not be available 31 Run Time 1004 error when calling sub from another macroThis is a
Excel Macro Runtime Error 1004 Document Not Saved
discussion on Run Time 1004 error when calling sub from another macro within the Excel Questions forums, part of
Excel Macro Runtime Error 1004 Paste Method Of Worksheet Class Failed
the Question Forums category; I am tryingto run a macro existing in another workbook opened by a variable, I am using the following code ... LinkBack LinkBack URL About LinkBacks Bookmark
Excel Macro Runtime Error 1004 Application-defined Or Object-defined Error
& Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Jan 19th, 2012,02:38 PM #1 Curben Board Regular Join Date Aug 2011 Posts 65 Run Time 1004 error when calling sub from another macro I am tryingto run a macro existing in another workbook opened by excel macro run time error 1004 a variable, I am using the following code to try and get it to work but i get Run-time error '1004': Cannot run the macro "Test 5.xlsm'!UpdTables'. The macro may not be available or all macros may be disabled. Code: Application.Run "'" & Application.ActiveWorkbook.Name & "'!UpdTables" Share Share this post on Digg Del.icio.us Technorati Twitter Reply With Quote Jan 19th, 2012,02:41 PM #2 shg MrExcel MVP Join Date May 2008 Location The Great State of Texas Posts 18,574 Re: Run Time 1004 error when calling sub from another macro Is the macro in a standard module (e.g., not in a sheet module)? Share Share this post on Digg Del.icio.us Technorati Twitter Microsoft MVP - Excel Reply With Quote Jan 19th, 2012,03:03 PM #3 Curben Board Regular Join Date Aug 2011 Posts 65 Re: Run Time 1004 error when calling sub from another macro no it is in a sheet labeled: Box Share Share this post on Digg Del.icio.us Technorati Twitter Reply With Quote Jan 19th, 2012,03:14 PM #4 Domenic MrExcel MVP Join Date Mar 2004 Location Canada Posts 16,874 Re: Run Time 1004 error when calling sub from another macro Th
be down. Please try the request again. Your cache administrator is webmaster. Generated Sat, 15 Oct 2016 09:38:14 GMT by s_ac15 (squid/3.5.20)
Posts Search Community Links Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts Go to Page... Thread Tools http://www.access-programmers.co.uk/forums/showthread.php?t=242870 Rating: Display Modes 02-28-2013, 04:42 AM #1 J3nny Newly Registered User Join http://www.pcreview.co.uk/threads/run-macro-in-another-workbook-error-1004.3972336/ Date: Jun 2011 Location: Glasgow, Scotland Posts: 11 Thanks: 2 Thanked 0 Times in 0 Posts [SOLVED] Run-time 1004 Error When Trying To Call Excel Macro Hi! I've been rummaging about online and trying to solve this for hours now and I've finally given up in the hope someone more endowed with brain cells can help me out.. error 1004 I'm working in Access, and I have a few reports that I run and that I've been copying and pasting into Excel and then doing some more work on. It occurred to me that I could write a macro to do all this for me, so I've made one in Access, and one in Excel to do the copying sheets etc, but the problem is in passing from one to the other. time error 1004 My Access module runs fine (after a lot of debugging) as does my Excel one, but I want Access to call the Excel macro at the end and hand over to it to finish the work. I put this part into a separate sub so I could test it without running the reports etc every time and this is my code: Public Sub RunExcelMacro() Dim objExcel As Object Dim objWorkBook As Object Set objExcel = CreateObject("Excel.Application") Set objWorkBook = objExcel.Workbooks.Open("H:\IT Department\General\Reporting\Season Ticket Analysis\Season Ticket Analysis - Data.xlsm") objExcel.Visible = True 'objExcel.DisplayAlerts = False objExcel.Run "SeasonTicketAnalysis" End Sub But I get this error. Run-time error '1004': Cannot run the macro 'SeasonTicketAnalysis'. The macro may not be available in this workbook or all macros may be disabled. Does anyone have any idea what the issue might be? It seems like an (unusually) helpful error message but I've checked that access to the Excel VB module is trusted (it is), that the name of the macro is spelled exactly as above (it is) and that the macro runs fine in Excel (it does), and that macro security isn't set to high (its set to the not recommended very low run all macros level), and after that I've run out of ideas. The macro is within the xls
have a number of different macros, each in a separate workbook. Now I want to create a macro in a new workbook that will open each workbook one at a time and run the macro contained in that workbook. My first attempt at this yielded the following error: Run-time error '1004': Cannot run the macro 'report1'. The macro may not be available in this workbook or all macros may be disabled. (The macro in the target workbook is defined as Public Sub Report1() and the one function in the code module is also defined as Public Function Find_col()) I did some experimenting and created two other workbooks with very simple macros (msgbox with text to show me what was executing) and then called them from the same workbook that I was starting to develop. I was able to execute both of the simple macros but still not able to execute the macro I really want to run. What should I look for in the target macro that is different from the two macros that I can successfully run? John Keith John Keith, Feb 21, 2010 #1 Advertisements John Keith Guest On Sun, 21 Feb 2010 15:15:39 -0700, John Keith <> wrote: >What should I look for in the target macro that is different from the >two macros that I can successfully run? > After playing around with this problem I finally found what the issue was. It seems that if the filename of the other workbook that has the macro I want to run has a space charater in it then the runtime error is produced. Seems strange that a valid filename would cause this error but after removing all the spaces everything worked as expected. John Keith John Keith, Feb 23, 2010 #2 Advertisements Dave Peterson Guest Are you using application.run to run the macro? If yes, then maybe... dim wkbk as workbook set wkbk = workbooks.open(filename:=yourpathandfilename, readonly:=true) application.run "'" & wkbk.name & '!macronamehere" Those apostrophes are important. John Keith wrote: > > On Sun, 21 Feb 2010 15:15:39 -0700, John Keith <> wrote: > > >What should I look for in the target macro that is different from the > >two macros that I can successfully run? > > > After playing around with this problem I finally found what the issue > was. It seems that if the filename of the other workbook that ha