Running Excel macro to format sheet from Labview?

Hey, thanks in advance.
I am trying to put together a VI that can run a macro in Excel. The macro I recorded simply formats some of the cells to be bold, sets the widths/heigths, merges some cells, adds some border, etc. I have been trying to piece together a bunch of examples from the discussion forum, from LV, etc. for doing this with ActiveX. I'm really starting to bang my head on the desk... all I need to do is make all the data my program sends to Excel pretty without having the operator (or supervisor) have to do this manually.
Does anyone have an example of a program that opens a file based on an extension you give it, runs a macro, then closes the file? Or other suggestions for doing this?
All the other examples I've looked at are different enough that I just can't make it work.
Thanks a million!

Well adam welcome to the world of active x. One trick I have learned with using it is when I want to do something in the program that uses macros (ie word, excel.) then what I do is create the macro and look at the code, then I will usually duplicate the code in labview using invoke and property nodes just because I do it that way does not mean it is the best way. I do it this way so I do not have to worry about someone deleting the macro. But running the macro is not trivial if you decide to go that route. Here are a bunch of vi's that will help you out.Message Edited by jhoskins on 04-27-2005 09:00 AM
Message Edited by jhoskins on 04-27-2005 09:00 AM
Joe.
"NOTHING IS EVER EASY"
Attachments:
Excel and word toolkit.zip ‏2013 KB

Similar Messages

  • How to run excel macro from ole

    hi to all experts.
    i need to run excel macro from ole

    Hi,
    *& Report  ZKC_TEST
    *& Description: Fancy report output in XL
    *&Programmer: Krishna Chauhan
    *&Date:       20 Feb 09
    REPORT  ZKC_TEST.
    * INCLUDES                                            *
    INCLUDE ole2incl.
    *&   TYPES                                            *
    TYPES: BEGIN OF ty_marc,
           matnr TYPE marc-matnr,
           werks TYPE marc-werks,
           pstat TYPE marc-pstat,
           lvorm TYPE marc-lvorm,
           ekgrp TYPE marc-ekgrp,
           END OF ty_marc.
    TYPES: BEGIN OF ty_titles,
           title(20) TYPE c,
           field(20) TYPE c,
           END OF ty_titles.
    *&   INTERNAL TABLES                                  *
    DATA: t_marc TYPE STANDARD TABLE OF ty_marc,
          t_titles TYPE STANDARD TABLE OF ty_titles.
    *&   FIELD-SYMBOLS                                    *
    FIELD-SYMBOLS: <fs_marc>   LIKE LINE OF t_marc,
                   <fs_titles> LIKE LINE OF t_titles,
                   <fs> TYPE ANY.
    *&   VARIABLES                                        *
    DATA: w_tabix TYPE sy-tabix,
          w_titles TYPE sy-tabix,
          w_line TYPE sy-tabix,
          w_field TYPE string,
          filename TYPE string,
          path TYPE string,
          fullpath TYPE string.
    DATA: data_titles TYPE REF TO data.
    DATA: e_sheet TYPE ole2_object,
          e_activesheet TYPE ole2_object,
          e_newsheet TYPE ole2_object,
          e_appl TYPE ole2_object,
          e_work TYPE ole2_object,
          e_cell TYPE ole2_object,
          e_color TYPE ole2_object,
          e_bold TYPE ole2_object.
    *&   SELECTION-SCREEN                                 *
    SELECTION-SCREEN BEGIN OF BLOCK b1.
    PARAMETERS: p_file TYPE rlgrap-filename.
    SELECTION-SCREEN END OF BLOCK b1.
    *&  START-OF-SELECTION                                *
    START-OF-SELECTION.
      PERFORM get_titles.
      PERFORM get_data.
      PERFORM create_excel.
    *& AT SELECTION-SCREEN                                *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title      = 'Select archivo'
          default_extension = 'xls'
          file_filter       = '*.xls'
        CHANGING
          filename          = filename
          path              = path
          fullpath          = fullpath.
      IF sy-subrc EQ 0.
        p_file = fullpath.
      ENDIF.
    *&      Form  get_titles                              *
    FORM get_titles.
      CREATE DATA data_titles TYPE ty_titles.
      ASSIGN data_titles->* TO <fs_titles>.
      <fs_titles>-title = 'Material'.
      <fs_titles>-field = 'MATNR'.
      APPEND <fs_titles> TO t_titles.
      <fs_titles>-title = 'Plant'.
      <fs_titles>-field = 'WERKS'.
      APPEND <fs_titles> TO t_titles.
      <fs_titles>-title = 'PSTAT'.
      <fs_titles>-field = 'PSTAT'.
      APPEND <fs_titles> TO t_titles.
      <fs_titles>-title = 'Deletion Flag'.
      <fs_titles>-field = 'LVORM'.
      APPEND <fs_titles> TO t_titles.
      <fs_titles>-title = 'EKGRP'.
      <fs_titles>-field = 'EKGRP'.
      APPEND <fs_titles> TO t_titles.
    ENDFORM.                    "get_titles
    *&      Form  get_data                                *
    FORM get_data.
      SELECT matnr werks pstat lvorm ekgrp
      INTO TABLE t_marc
      FROM marc
      WHERE matnr = '000000000001013351'.
    ENDFORM.                    " get_data
    *&      Form  create_excel                            *
    FORM create_excel.
      w_line = 1.
      CREATE OBJECT e_appl 'EXCEL.APPLICATION'.
      SET PROPERTY OF e_appl 'VISIBLE' = 1.
      CALL METHOD OF e_appl 'WORKBOOKS' = e_work.
      CALL METHOD OF e_work 'Add' = e_work.
      GET PROPERTY OF e_appl 'ActiveSheet' = e_activesheet.
      SET PROPERTY OF e_activesheet 'Name' = 'Material Plants'.
      LOOP AT t_marc ASSIGNING <fs_marc>.
        w_tabix = sy-tabix.
        w_line = w_line + 1.
        LOOP AT t_titles ASSIGNING <fs_titles>.
          w_titles = sy-tabix.
          CALL METHOD OF e_appl 'Cells' = e_cell
            EXPORTING
              #1 = 1
              #2 = w_titles.
          SET PROPERTY OF e_cell 'Value' =  <fs_titles>-title.
          GET PROPERTY OF e_cell 'Interior' = e_color.
          SET PROPERTY OF e_color 'ColorIndex' = 35.
          GET PROPERTY OF e_cell 'Font' = e_bold.
          SET PROPERTY OF e_bold 'Bold' = 1.
          CALL METHOD OF e_appl 'Cells' = e_cell
            EXPORTING
              #1 = w_line
              #2 = w_titles.
          CONCATENATE '<fs_marc>-' <fs_titles>-field
          INTO w_field.
          ASSIGN (w_field) TO <fs>.
          SET PROPERTY OF e_cell 'Value' = <fs>.
          GET PROPERTY OF e_cell 'Interior' = e_color.
          SET PROPERTY OF e_cell 'ColumnWidth' = 20.
          SET PROPERTY OF e_color 'ColorIndex' = 0.
          GET PROPERTY OF e_cell 'Font' = e_bold.
          SET PROPERTY OF e_bold 'Bold' = 0.
        ENDLOOP.
      ENDLOOP.
      CALL METHOD OF e_work 'SAVEAS'
        EXPORTING
          #1 = p_file.
      CALL METHOD OF e_work 'close'.
      CALL METHOD OF e_appl 'QUIT'.
      FREE OBJECT e_appl.
    ENDFORM.                    " create_excel

  • How to run Excel Macros using JDBC-ODBC

    Hi,
    I want to run the excel macros in the excel file, after I connected to excel file, using JDBC-ODBC bridge.
    How macros treated here?
    Help needed please..........
    - Ramesh

    How to run Excel Macros using JDBC-ODBCYou don't.
    As my fuzzy understanding goes.....
    Macros (excel, word, etc) run via a "OLE" extension of the script host system.
    So the only way to run them is via the OLE interface. That has nothing to do with ODBC. You can write your own JNI to do that, or you might get lucky and find that someone else has written a java library to do it for you.

  • Running Excel macros from ABAP

    Hello everyone,
    I am trying to execute an Excel macro from an ABAP program.  We are currently on a 46C system.  While doing some research on help.sap.com I came across the method execute_macro in class i_oi_document_proxy.  I’ve never used methods in ABAP before and I’m not really sure what I’m doing.  Has anyone got this to work?  When I try to run the program it dumps with error OBJECTS_OBJREF_NOT_ASSIGNED.
    Thanks,
    Becky
    Here is the program:
    REPORT ztest_program.
    INCLUDE ole2incl.
    DATA gs_excel TYPE ole2_object .
    DATA gs_wbooks TYPE ole2_object .
    DATA gs_wbook TYPE ole2_object .
    DATA gs_application TYPE ole2_object .
    DATA: h_sheet TYPE ole2_object.
    DATA: document TYPE REF TO i_oi_document_proxy.
    *Name of the macro in Excel
    DATA: macro_string(50) TYPE c
                     VALUE 'FB03process.FromTheBeginning',
          no_flush TYPE c,
          param_count TYPE i VALUE 0,
          script_name TYPE c VALUE 'X',
          error TYPE REF TO i_oi_error
                OCCURS 0 WITH HEADER LINE,
          retcode TYPE soi_ret_string,
          error_string(50) TYPE c,
          retvalue(30) TYPE c.
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
       EXPORTING
             text       = text-007
         EXCEPTIONS
              OTHERS     = 1.
    CREATE OBJECT gs_excel 'EXCEL.APPLICATION' .
    SET PROPERTY OF gs_excel 'Visible' = 1 .
    GET PROPERTY OF gs_excel 'Workbooks' = gs_wbooks .
    GET PROPERTY OF gs_wbooks 'Application' = gs_application .
    *--Opening the existing document
    CALL METHOD OF gs_wbooks 'Open' = gs_wbook
         EXPORTING #1 = 'D:\temp\FB03process.xls' .
    tell user what is going on
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
       EXPORTING
              PERCENTAGE = 0
             text       = text-009
         EXCEPTIONS
              OTHERS     = 1.
    GET PROPERTY OF gs_excel 'ACTIVESHEET' = h_sheet.
    CALL METHOD document->execute_macro
         EXPORTING macro_string  = macro_string
                   param_count   = param_count
                   script_name   = script_name
                   no_flush      = no_flush
         IMPORTING error         = error
                   retcode       = retcode
         CHANGING  error_string  = error_string
                   retvalue      = retvalue.
    disconnect from Excel
    FREE OBJECT gs_excel.
    PERFORM err_hdl.
    FORM err_hdl.
      IF sy-subrc <> 0.
        WRITE: / 'Fehler bei OLE-Automation:'(010), sy-subrc.
        STOP.
      ENDIF.
    ENDFORM.                    " ERR_HDL

    Hi,
    Please correct me if I am wrong but it seems that you have not fetched a handle to the document object before issuing the statement CALL METHOD document->execute_macro. Hence the error OBJECTS_OBJREF_NOT_ASSIGNED is being dislayed. If you want to use SAP Desktop Office Integration using ABAP Objects, take a look at this article at http://www.intelligenterp.com/feature/archive/ or http://www.sapinfo.net/public/en/index.php4/article/comvArticle-193333c63b4bd807d2/en/articleStatistic
    Hope this helps.
    Regards
    Message was edited by: Shehryar Khan

  • How to run excel macros using lookout

    Hi,
    I want use Excel macros for generating custom reports.Is it possible to run macros using run object in lookout
    thanks

    Hi,
    I am pretty sure you can activate macros in Excel using the Run object in Lookout. I can think of two ways you can do this:
    1. You can setup your Excel to run macros on startup using the Auto_Activate method. In this case, you will just launch excel with your workbook using the Run object and that should run the macros automatically. No brainer!
    2. To better control as to when the macros are run we can assign in Excel some shortcut keys for their launching. We then would need to simulate these keystrokes to launch our macros. This can be done using the SendKeys method and some scripting, WHS Scripting for instance. See this pos
    t for a scripting example which simulates Alt+Tab keys to bring-to-front an app.
    You will launch the script from the Run object and this in turn launches Excel and then simulates the keys for luanching the appropriate macros. I admit this is kinda involved, but hey it works!
    Hope this helps,
    Khalid

  • How to Print the Excel Sheet From Labview??

    Hii Every body,,
     Actually i am logging my data to Excel Template..... Now in my front panel i will select that excel file and give  print... Now automatically the datas in the excel sheet have to get printed with out opening the excel sheel... how to do?? can any 1 suggest me??

    I think you can get many/most of your answers here in the Excel Board thread in Breakpoint forum.
    - Partha
    LabVIEW - Wires that catch bugs!

  • I have problem with running excel macro in report generation tool kit

    I am trying to use Excel Run Macro.vi but run into a problem: Exception occured in Microsoft Excel, The macro 'personal.xls!Macro1' cannot be found.. Help Path is C:\Program Files\Microsoft Office\Office\1033\xlmain9.chm and context 0 in Excel Run Macro.vi->example.vi
    Also I tried to save the macro under the file that is active and I get the same results.
    I saved the macro as *.bas file and ran it using Excel Import Module and did not see any erreos and it did not do anything.
    Where a re some god examples that use the excel marco feature using the new report generation vis?

    masoud,
    Try this example out and let me know if you have any more questions. Also, this is in LabVIEW 6.1 format. If you need it in a different format, please let me know.
    Randy Hoskin
    Applications Engineer
    National Instruments
    http://www.ni.com/ask
    Attachments:
    Module1.bas ‏1 KB
    TestAddMacro.vi ‏34 KB

  • How to call excel macros programmatically in C#?

    Hi,
    I have a requirement where i need to call excel (2003) macros in C# program. Can anyone help me with a code snippet to do the same?
    The excel macro function takes two input parameters? how can the parameters be passed?
    Any code snippet to do the same in C# would be helpful.
    Thanks.

    Hey there, Sid.  I am tryin gto run your code, but I couldn't even gte it to fire.  Here's what I ahve now:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using Excel = Microsoft.Office.Interop.Excel;
    namespace WindowsFormsApplication2
        public partial class Form1 : Form
            private void button1_Click(object sender, EventArgs e)
                //~~> Define your Excel Objects
                Excel.Application xlApp = new Excel.Application();
                Excel.Workbook xlWorkBook;
                //~~> Start Excel and open the workbook.
                xlWorkBook = xlApp.Workbooks.Open("C:\\Users\\Ryan\\Desktop\\Coding\\Microsoft Excel\\Work Samples\\Work Samples\\Historical Stock Prices.xlsb");
                //~~> Run the macros by supplying the necessary arguments
                xlApp.Run("ShowMsg", "Hello from C# Client", "Demo to run Excel macros from C#");
                //~~> Clean-up: Close the workbook
                xlWorkBook.Close(false);
                //~~> Quit the Excel Application
                xlApp.Quit();
                //~~> Clean Up
                releaseObject(xlApp);
                releaseObject(xlWorkBook);
            //~~> Release the objects
            private void releaseObject(object obj)
                try
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
                    obj = null;
                catch (Exception ex)
                    obj = null;
                finally
                    GC.Collect();
    When I hit the play button nothing happens.  When I hot F5 nothing happens.  Do you ahve any idea what I'm doing wrong.  I'd appreciate any advice with this!! 
    Thanks!!
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • How can I export formatted text from a string indicator?

    Does someone know how I can export formatted text (i.e., parts of the text have different formatting, such as color, fontsize, etc.) from a string indicator? Using copy/paste does not work, as it only exports unformatted plain text.

    Hello Sparti,
        Thank you for your suggestions, they are all very useful, and I plan to use the HTML feature under Report Generation to export the formatted text from Labview. However, I am still not sure how I can extract the formatted text from a *string indicator* and transfer it to one of those VIs, so that it can be exported to other applications. Let me give some more specific info on what I am trying to achieve:  I am monitoring the communication between two pieces of equipment. A string indicator shows all the data flow, with different colors for data coming from different instruments. I managed to do that by using a property node and playing with the selection and font color properties. Now, if you just wire the output of the string indicator, the formatting is gone and all you get is just plain black text (for instance, try to programmatically transfer the formatted text from one string indicator to a different string indicator and you will see that the formatting is not preserved). Even if you try the "brute force" method of manually selecting and copying the text in the indicator and pasting it to Word, LV does not export the formatting. But, if you paste *within*  LV (for example, paste it to a string constant in your diagram), then it works. To extract the formatted string from the indicator, I also tried to use a property node, but without success. I am trying to avoid duplicating part of my code to generate the same color-coding scheme on a report. It would be way easier to be able to transfer the formatted text from the string indicator. This is particularly annoying, because the information is there, stored in the data structure associated with the string indicator. But how can I put my hands on it? Any ideas?

  • When calling Excel 97 Macro from Labview 5.1, get error: cant find macro!

    I have a macro written that I am trying to call from Labview. To assist in this task I downloaded an Excel Macro VI off the NI Websight. The VI came with an excel workbook that included a sample macro. I can run the example with no problems. I then modified the VI to fit what I am trying to do. I can get it to work with the Sample excel macro but not the one I created (I get an error saying it can't find the Macro). I have played with the timing and that has not worked. I have also noticed that when I use the sample Macro, it will work fine for a while then after a random number of executions, it will stop working and I will get the same error as with my Macro. In order to get it working ag
    ain, I have to remove the sample worksheet (macro) and replace it with the original copy. I have been pulling my hair out for a couple of days now with this one so any help would be greatly appreciated!

    I am not sure what the problem could be. The VI you speak of can be found at the following link:
    http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/190d1f351297ef9a862567740073e2bc?OpenDocument
    I ran the program for excel 2000 on my LabVIEW 6.1 about 50 times and did not get the error you reported. Your macro should not be corrupted with use. Have you considered reinstalling excel? I liked the idea about turning off multithreading. Do you see the same behavior if you run in high light execution mode?
    Jeremy Braden
    National Instruments

  • I am using LABview 5.0 and I am having difficulty with running EXCEL 2000 and my macros after I build an application.

    Excel opens and runs the macros correctly in my development programme, but when I build an application and try to run it, Excel opens but does not put the data into the cells or run the macros. Excel opens and runs the macros correctly in my development programme, but when I build an application and try to run it, Excel opens but does not put the data into the cells or run the macros.
    The error message is 'Object is not registered in set cell value.vi code-2147220997
    I stress that it all works OK until the application is built. Set cell value.vi was downloaded from this site. I am using Windows 98.
    Any help would be appreciated.

    Be sure you have your Excel activex controls properly registered in your system, there are lots of activex registerers in the web. If this does not work, look at set cell value vi and check for invalid refnums. If even this fails, i'd try reinstalling app builder, but be sure you install it before any LV update (for example 5.0.1f1) unless you want problems like i had with Excel built examples. You can also send an example, and see if i can fix it, but i don't have excel 2000 (only 97) so i don't know if i can do anything else.
    Hope this helps

  • How to simplify opening/closing Excel to grab data from LabView based software running outside the main VI

    Hi,
    Right now I have a program written to automate an AOP pilot with a few inputs and outputs (3 valves, ozone generator, UV lamp, TOC meter, ozone meter in liquid and gas phase, and a UV-VIS detector). The valves are controlled with digital outputs, the rest are analog in- an outputs going into a USB-6009. The one exception is the UV-VIS detector (S::CAN Spectro::lyser). We read in about 200 Abs/m values with their corresponding wavelengths. The software of this tool is ran on the same computer and it writes down these values in an Excel file (.fp). My VI needs to select this excel file while running, and grabs the corresponding data from the Excel file. I made a finetuner to select the latest data from the excel file. Now, even though this works, it's not practical for many reasons. It closes all other excel files while running for example, and opens and closes Excel twice in 30 seconds.
    I found out the software of the UV-VIS detector is written in LabView too, but the company doesn't seem to care much about sharing the original VI's or making it complementary with other LabView VI's. Now I was wondering if there's an easier solution than opening/closing Excel. Are global variables an option for this problem? I'm far from an expect in LabView, so I just want to know if I should put in the time to learn about global variables or not
    Thanks in advance.
    Dominic

    hello dominic;
    I have read your study about AOP recently and I wonder your Labview VI. Can you share the code you used with me?
    kind regards,
    Dr. Baris OZLUOYMAK
    Electrical and Electronics Engineer (MSc)
    University of Cukurova, Faculty of Agriculture,
    Department of Agricultural Machinery,
    01330 Adana / TURKEY
    Tel: 90 322 3386408
    Fax: 90 322 3387165
    E-mail: [email protected]

  • Pivot onto sheet from POV removes Excel formatting

    When I check "Use Excel Formatting" in the SmartView 11.1.1.3 Display tab, I can drill up and down in on sheet dimensions and Excel will retain the data's numeric formatting.
    When I pivot a dimension onto the sheet from the POV, the formatting is removed.
    Is this by design, or is it a bug, or am I yet again doing something dumb? My track record suggests the last, but you never know.
    Regards,
    Cameron Lackpour

    Mike,
    To echo Glenn's comment -- SmartView is not getting a lot of love over on Network54: http://www.network54.com/Forum/58296/thread/1269029730/Retain+number+formating+in+Smart+View
    I am trying, really hard, to make the switch to SmartView because there are so many other compelling features but this sort of thing just kills it for me. I've spent the last three days validating data in Essbase against an OFA application (don't even ask). I started out in SmartView but couldn't take it, and reverted to the Excel add-in. Hey, at least Smart View beats OFA's client. :)
    I wonder if classic Essbase add-in users are ever going to make the switch. I guess parity between the two products will determine who are the bitter-enders I know I fall guiltiy to loving the product I know.
    Regards,
    Cameron Lackpour
    P.S. Glenn -- which one are you -- GlennS_2 and GlennS_3 all in the same thread?

  • I get the error code -2146827284 when trying to run an Ecxel macro from LabVIEW.

    I am trying to insert data in an Excel workbook and then run a macro which I recorded in Excel to produce a plot.
    This worked great on a laptop running W2K + LV7 and Office 2000.
    I am now trying to do the same thing on a WinXP + LV7 + Excel 2002 and I get this error.
    The complete message is:
    "Error -2146827284 occurred at Exception occured in Microsoft Excel, Programmatic access to Visual Basic Project is not trusted
    . Help Path is C:\Program Files\Microsoft Office\Office10\1033\xlmain10.chm and context 0 in Excel Import Module.vi->LV report test1.vi
    This error code is undefined. No one has provided a description for this code, or you might have wired a number that is not an
    error code to the error code input."
    Can anyone shed some light on this. Running a macro is the obvious and easy way to get this work done.
    See the attached VI. It includes the macro and some sample data to run it on.
    Attachments:
    LV_report_test1.vi ‏46 KB

    Hi,
    I have attached a link to a document that discusses the error you are getting:
    Error -2146827284 When Importing a Macro to Office 2002/XP
    I hope this helps.
    Sincerely,
    Feroz
    National Instruments

  • Excel VBA: Getting error 1004 using APPLICATION.RUN to run a macro

        
    I'm getting a 1004 error when my ADDIN tries to launch a macro already in a workbook .
    The macro resides in a workbook (on disk before it was opened in this session) and the addin opened the workbook, updated some data fields in spreasheets in the workbook and now is trying to cause the macro, already in that workbook, to execute as though
    the user had opened the workbook, made the changes, and clicked the button connected to that macro.  What the addin copied into the workbook was data in cells that the macro uses for inputs to its calcualtions.
    The error reads: "The macro may not be available in this workbook or all macros may be disabled"
    The command in question is in an ADDIN and its code is effectively:
    v2="Taxplan Template 1.17.xlsm!SUMMARIZEYEAR
    Application.run v2
    ...etc
    Immediately upon executing "Application.run " it jumps to the on error location.
    Taxplan Template 1.17.xlsm is open and accessible (the addin has just copied data into it and the macro is to update a summary based on that updated data) and it contains the macro Summarizeyear which has no arguments and is not private. 
    If I set a breakpoint in the addin right before the "Application.run", stop the addin and manually run the macro it works fine.  It begins like:
    Sub SummarizeYear()
    Sheets("Summary").Select
    ...etc
    If I manually open the workbook  Taxplan Template 1.17 I can run the macro SUMMARIZEYEAR without issue.
    Macros are enabled in Excel.
    Probably not pertinent but I've used the same style of code with .xls workbooks in the past without a hitch, this is the first instance where I used it with .xlsm format workbooks.
    Excel 2007 SP3
    Thanks

    I'm getting a 1004 error when my ADDIN tries to launch a macro already in a workbook .
    The macro resides in a workbook (on disk before it was opened in this session) and the addin opened the workbook, updated some data fields in spreasheets in the workbook and now is trying to cause the macro, already in that workbook, to execute as though
    the user had opened the workbook, made the changes, and clicked the button connected to that macro.  What the addin copied into the workbook was data in cells that the macro uses for inputs to its calcualtions.
    The error reads: "The macro may not be available in this workbook or all macros may be disabled"
    The command in question is in an ADDIN and its code is effectively:
    v2="Taxplan Template 1.17.xlsm!SUMMARIZEYEAR
    Application.run v2
    ...etc
    Immediately upon executing "Application.run " it jumps to the on error location.
    Taxplan Template 1.17.xlsm is open and accessible (the addin has just copied data into it and the macro is to update a summary based on that updated data) and it contains the macro Summarizeyear which has no arguments and is not private. 
    If I set a breakpoint in the addin right before the "Application.run", stop the addin and manually run the macro it works fine.  It begins like:
    Sub SummarizeYear()
    Sheets("Summary").Select
    ...etc
    If I manually open the workbook  Taxplan Template 1.17 I can run the macro SUMMARIZEYEAR without issue.
    Macros are enabled in Excel.
    Probably not pertinent but I've used the same style of code with .xls workbooks in the past without a hitch, this is the first instance where I used it with .xlsm format workbooks.
    Excel 2007 SP3
    Thanks
    This line is not quite correct,
    v2="Taxplan Template 1.17.xlsm!SUMMARIZEYEAR
    it is missing the closing double quote, also since your file name contains a space, I would also enclose it in single quotes.

Maybe you are looking for

  • Anyone else been getting messed up engraving on devices?

    Over the past few months I have ordered several iPod Touch 4Gs from the Apple website. My main reason for ordering them directly from Apple was to get the free engraving. The purchase price was no lower than I could have purchased them for from Wal-M

  • Adobe Bridge turning off Aero mode intermittently

    Hi there, I use CS4 extended. I use bridge for my Raw work. Sometimes (Approx 50%) when I open bridge from the taskbar I find that aero crashes and it changes to compatability mode. I can use the computer and Bridge fine. If I shut Bridge when finish

  • FCC for file receiver help

    Hi all, My source xml is: node1_mt <node2>   <node3> 0 to u      field1      field2      field3      <node4> 0 to u         fielda         fieldb         fieldc      </node4>   </node3>   fieldaa   fieldbb My target file should be: (csv) field1 field

  • Software insrumen sounds break up when played - 3 EXS projet

    My project has 3 EXS tracks. They're all based on the same Piano patch. One is ringshifted, the other has AVerb on it and the third has no effects. When I play no. 1 the sound is OK. But I only have to play a few quick notes on 2 or 3 to for the soun

  • HP Photosmart C5550 All-in-One

    My Printer Keeps Stopping , This Message Keeps Coming Up ,   824C1900