Adding MACRO to WORKBOOK

Hi,
I have a workbook contains 2 queries, i would like to append macro to the workbook for additional formatting, I have macro created which takes input from desktop and saves the output on desktop.
How can i add this Macro to the workbook, I have gone through all the posts, Once after i am in VBA editor and add module, i am not getting                                                                                Sub SAPBEXonRefresh(queryID As String, resultArea As Range)  by default, Is this normal, Do we need to manually type this.  and whats the id we need to give is this query technical name or something else and what  parameters we need to give for resultarea,
Can you guys provide as many detaisl as possible.
Weare in 3.5 version, we are planning to move into BW 7 does this macros work in BI7?
ThankS,
Nav

Thanks for your quick response, What exactly shortcut is?
Can you tell me whether   Sub SAPBEXonRefresh(queryID As String, resultArea As Range) will be there by default or we need to manullay maintain,
queryID As String,  what exactly we need to enter here
resultArea As Range  what exactly we need to enter here
Thanks,
Naveen

Similar Messages

  • How to open excel files from email in macro enabled workbooks NOT 2003-2007 worksheets?

    I have recently installed Office 365 and it was working great. I needed to open excel documents via email with the macro enabled option. Yesterday it flicked back to only giving me the option to open in 2003-2007 workbook so now I am having issues with the
    macros. I am contracting and trying to get work out and this has now caused huge problems.
    Am thinking of uninstalling and reinstalling. I did have older versions of ms office so maybe there is some residual content there to remove? I have tried to change the associations and protocols to open in excel macro enabled workbooks but these tick boxes
    are greyed out and I do not know how to gain access to these. Have been hunting all through my computer system but do not know how to do this. Am no expert. 
    If someone could help I would really appreciate it otherwise will need to find some computer shop expert I suppose...urgently ha.
    Thanks in advance

    it's sound like excel 13 disable the macros, turn on it will fix your issue.
    see here:
    http://office.microsoft.com/en-us/excel-help/enable-or-disable-macros-in-office-files-HA010354316.aspx
    ps: use the local admin to change the setting, the reason why the setting grey out.
    KR

  • Adding a BW Workbook to the SAP Gateway

    Dear SDNers,
    I am trying to assign a BW Workbook ("WB" report type) in the "Reporting Administration > Report settings > Manage reports and their properties" section of the Gateway, but the system doesn't recognize the tehcnical name...
    Have you already experienced this issue?
    Many thanks
    Thibaud

    Hi,
    adding a value as default value for a variable is only relevant for the selection screen.
    If u want to define # in the navigation pane u can do that there and save the workbook.
    Then # is saved as filter on workbook lvl, but its changeable by the user.
    Hint: In analysis mode disable "initial query view on refresh" in dataprovider settings of the analysis grid.
    Regards
    Tobias
    P.S. Giving points is the way to say thx in SDN!!!
    Edited by: Tobias on Jun 6, 2008 7:50 AM

  • Excel Macro to click on publish button of Master Data Services Add-in

    I am creating an excel macro to perform extra validation and defaults whilst the user is editing the MDS entity. It will be added as a workbook add-in. At the end of the macro I would like to be able to launch publish. The MDS addin is a ribbon.
    Does anyone have an example of how I can simulate a click on the Publish button or what the call that the button does is?
    David Roseneder

    Hi David
    here is a code sample to add mds actions with excel Buttons
    you can find the connection class separately, by downloading my sample project (C#) on codeplex :
    http://mdsmanager.codeplex.com
    (I use this MDS connection class for many projects)
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Xml.Linq;
    using Microsoft.VisualStudio.Tools.Applications.Runtime;
    using Excel = Microsoft.Office.Interop.Excel;
    using Office = Microsoft.Office.Core;
    using System.Xml;
    using System.Collections.ObjectModel;
    using Common.ServiceReference1;
    namespace ExcelToMDS
    public partial class Sheet1
    public const string mdsEndPoint = "http://yourMDSEndpointUrl:4040/Service/Service.svc";
    ServiceClient c = null;
    International intl = new International();
    OperationResult or = new OperationResult();
    Metadata md = null;
    private void Sheet1_Startup(object sender, System.EventArgs e)
    using (var c = Common.MDS_WSConnect.CreateMdsProxy("yourdomain", "yourlogin", "yourpassword", mdsEndPoint))
    c.Open();
    International intl = new International();
    OperationResult or = new OperationResult();
    md = GetMetaData(intl, ref or);
    cbModels.Items.Clear();
    foreach (Model mo in md.Models)
    cbModels.Items.Add(mo.Identifier);
    cbModels.DisplayMember = "Name";
    cbEntities.Visible = true;
    private Metadata GetMetaData(International intl, ref OperationResult or)
    MetadataResultOptions mro = new MetadataResultOptions();
    MetadataSearchCriteria msc = new MetadataSearchCriteria();
    msc.Models = new Collection<Identifier>() { new Identifier() };
    msc.Versions = new Collection<Identifier>() { new Identifier() };
    msc.SearchOption = SearchOption.UserDefinedObjectsOnly;
    mro.Models = ResultType.Identifiers;
    mro.Versions = ResultType.Identifiers;
    cbModels.Items.Clear();
    Metadata md = c.MetadataGet(intl, mro, msc, out or);
    return md;
    private void Sheet1_Shutdown(object sender, System.EventArgs e)
    if (c != null && c.State != System.ServiceModel.CommunicationState.Closed)
    c.Close();
    #region VSTO Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InternalStartup()
    this.btGetMDSData.Click += new System.EventHandler(this.btGetMDSData_Click);
    this.btGetTransactions.Click += new System.EventHandler(this.btGetTransactions_Click);
    this.btUpdateAttribute.Click += new System.EventHandler(this.btUpdateAttribute_Click);
    this.cbModels.SelectedIndexChanged += new System.EventHandler(this.cbModels_SelectedIndexChanged);
    this.cbMembers.SelectedIndexChanged += new System.EventHandler(this.cbMembers_SelectedIndexChanged);
    this.cbEntities.SelectedIndexChanged += new System.EventHandler(this.cbEntities_SelectedIndexChanged);
    this.cbVersions.SelectedIndexChanged += new System.EventHandler(this.cbVersions_SelectedIndexChanged);
    this.cbAttributes.SelectedIndexChanged += new System.EventHandler(this.cbAttributes_SelectedIndexChanged);
    this.btReverseTran.Click += new System.EventHandler(this.btReverseTran_Click);
    this.Shutdown += new System.EventHandler(this.Sheet1_Shutdown);
    this.Startup += new System.EventHandler(this.Sheet1_Startup);
    #endregion
    private void btGetMDSData_Click(object sender, EventArgs e)
    Cursor.Current = Cursors.WaitCursor;
    DisplayEntityMembers(c);
    Cursor.Current = Cursors.Default;
    private void DisplayEntityMembers(ServiceClient c)
    EntityMembers em = GetEntityMembers(c);
    if (em != null)
    Member[] members = em.Members.ToArray();
    ((Excel.Range)this.Cells[2, 2]).Value2 = "MemberName";
    ((Excel.Range)this.Cells[2, 3]).Value2 = "AttributeName";
    ((Excel.Range)this.Cells[2, 4]).Value2 = "AttributeValue";
    for (int i = 0; i < members.Length; i++)
    ((Excel.Range)this.Cells[i + 3, 2]).Value2 = members[i].MemberId.Name;
    int cptAtt = 0;
    foreach (Common.ServiceReference1.Attribute att in members[i].Attributes)
    ((Excel.Range)this.Cells[i + 3, cptAtt + 3]).Value2 = att.Identifier.Name.ToString();
    ((Excel.Range)this.Cells[i + 3, cptAtt + 4]).Value2 = att.Value != null ? att.Value.ToString() : "";
    cptAtt += members[i].Attributes.Count();
    private EntityMembers GetEntityMembers(ServiceClient c)
    if (cbModels.SelectedItem != null && cbEntities.SelectedItem != null && cbVersions.SelectedItem != null)
    EntityMembersGetCriteria emGetCrit = new EntityMembersGetCriteria();
    emGetCrit.ModelId = new Identifier() { Name = ((Identifier)cbModels.SelectedItem).Name };
    emGetCrit.EntityId = new Identifier() { Name = ((Identifier)cbEntities.SelectedItem).Name };
    emGetCrit.VersionId = new Identifier() { Name = ((Identifier)cbVersions.SelectedItem).Name };
    //ExportView[] ev = c.ExportViewListGet(new International(), out or);
    EntityMembersInformation emi = new EntityMembersInformation();
    emGetCrit.DisplayType = DisplayType.CodeName;
    EntityMembers em = c.EntityMembersGet(intl, emGetCrit, out emi, out or);
    return em;
    else
    MessageBox.Show("Please select model, version and entity in comboboxes");
    return null;
    private void btGetTransactions_Click(object sender, EventArgs e)
    if (cbModels.SelectedItem != null)
    this.Rows.Clear();
    using (var c = Common.MDS_WSConnect.CreateMdsProxy("yourdomain", "yourlogin", "yourpassword", mdsEndPoint))
    c.Open();
    DisplayTransactions(c);
    c.Close();
    else
    MessageBox.Show("Please select Model in combos");
    private void DisplayTransactions(ServiceClient c)
    string versionName = "VERSION_1";
    if (cbVersions.SelectedItem != null)
    versionName = ((Identifier)cbVersions.SelectedItem).Name;
    TransactionSearchCriteria trSrchCrit = new TransactionSearchCriteria();
    trSrchCrit.ModelId = new Identifier() { Name = ((Identifier)cbModels.SelectedItem).Name };
    //trSrchCrit.EntityId = new Identifier() { Name = ((Identifier)cbEntities.SelectedItem).Name };
    trSrchCrit.EntityId = new Identifier();
    trSrchCrit.VersionId = new Identifier() { Name = versionName };
    //ExportView[] ev = c.ExportViewListGet(new International(), out or);
    EntityMembersInformation emi = new EntityMembersInformation();
    int totalTranCount = 0;
    Collection<Transaction> transactions = new Collection<Transaction>();
    OperationResult or = c.TransactionsGet(intl, trSrchCrit, out totalTranCount, out transactions);
    int startY = 4;
    int startDataY = startY + 1;
    int startX = 4;
    ((Excel.Range)this.Cells[startY, startX]).Value2 = "TransactionID";
    ((Excel.Range)this.Cells[startY, startX + 1]).Value2 = "Code";
    ((Excel.Range)this.Cells[startY, startX + 2]).Value2 = "Name";
    ((Excel.Range)this.Cells[startY, startX + 3]).Value2 = "MemberType";
    ((Excel.Range)this.Cells[startY, startX + 4]).Value2 = "Date";
    ((Excel.Range)this.Cells[startY, startX + 5]).Value2 = "AttributeName";
    ((Excel.Range)this.Cells[startY, startX + 6]).Value2 = "PriorValue";
    ((Excel.Range)this.Cells[startY, startX + 7]).Value2 = "NewValue";
    for (int i = 0; i < transactions.Count(); i++)
    ((Excel.Range)this.Cells[i + startDataY, startX]).Value2 = transactions[i].Id.ToString();
    ((Excel.Range)this.Cells[i + startDataY, startX + 1]).Value2 = transactions[i].MemberId.Code;
    ((Excel.Range)this.Cells[i + startDataY, startX + 2]).Value2 = transactions[i].MemberId.Name;
    ((Excel.Range)this.Cells[i + startDataY, startX + 3]).Value2 = transactions[i].MemberId.MemberType.ToString();
    ((Excel.Range)this.Cells[i + startDataY, startX + 4]).Value2 = transactions[i].Date.ToString();
    ((Excel.Range)this.Cells[i + startDataY, startX + 5]).Value2 = transactions[i].AttributeId.Name;
    ((Excel.Range)this.Cells[i + startDataY, startX + 6]).Value2 = transactions[i].PriorValue;
    ((Excel.Range)this.Cells[i + startDataY, startX + 7]).Value2 = transactions[i].NewValue;
    private void btUpdateAttribute_Click(object sender, EventArgs e)
    Cursor.Current = Cursors.WaitCursor;
    using (var c = Common.MDS_WSConnect.CreateMdsProxy("yourdomain", "yourlogin", "yourpassword", mdsEndPoint))
    c.Open();
    EntityMembers em = GetEntityMembers(c);
    Member[] members = em.Members.ToArray();
    for (int i = 0; i < members.Length; i++)
    ((Excel.Range)this.Cells[i + 3, 2]).Value2 = members[i].MemberId.Name;
    foreach (Common.ServiceReference1.Attribute att in members[i].Attributes)
    if (att.Identifier.Name == "ValidDandT")
    att.Value = DateTime.Now;
    c.EntityMembersUpdate(intl, em);
    DisplayEntityMembers(c);
    c.Close();
    Cursor.Current = Cursors.Default;
    private void cbModels_SelectedIndexChanged(object sender, EventArgs e)
    Identifier i = (Identifier)cbModels.SelectedItem;
    if (md != null)
    cbVersions.Items.Clear();
    foreach (Common.ServiceReference1.Version v in md.Versions)
    if (v.Identifier.ModelId.Id == i.Id)
    cbVersions.Items.Add(v.Identifier);
    cbVersions.DisplayMember = "Name";
    private void cbVersions_SelectedIndexChanged(object sender, EventArgs e)
    Identifier iVer = (Identifier)cbVersions.SelectedItem;
    ModelMembersGetCriteria mmgc = new ModelMembersGetCriteria();
    mmgc.Models = new Collection<Identifier>() { new Identifier() { Name = ((Identifier)cbModels.SelectedItem).Name } };
    ModelMembersResultCriteria mmrc = new ModelMembersResultCriteria();
    mmgc.Versions = new Collection<Identifier>() { new Identifier() { Id = iVer.Id } };
    mmrc.IncludeLeafMembers = true;
    cbEntities.Items.Clear();
    cbMembers.Items.Clear();
    Collection<EntityMembers> colEm = c.ModelMembersGet(intl, mmgc, mmrc, out or);
    foreach (EntityMembers em in colEm)
    cbEntities.Items.Add(em.EntityId);
    cbEntities.DisplayMember = "Name";
    private void cbEntities_SelectedIndexChanged(object sender, EventArgs e)
    DisplayEntityAttributesCombo(c);
    DisplayEntityAttributesAndMembersInSheet();
    private void DisplayEntityAttributesAndMembersInSheet()
    EntityMembers em = GetEntityMembers(c);
    Member[] members = em.Members.ToArray();
    ((Excel.Range)this.Cells[2, 2]).Value2 = "MemberName";
    ((Excel.Range)this.Cells[2, 3]).Value2 = "AttributeName";
    ((Excel.Range)this.Cells[2, 4]).Value2 = "AttributeValue";
    if (members.Count() > 0)
    int ii = 0;
    //attributes name on header line
    foreach (Common.ServiceReference1.Attribute att in members[0].Attributes)
    ((Excel.Range)this.Cells[3, ii + 3]).Value2 = att.Identifier.Name.ToString();
    ii++;
    //members Data
    int cptnbAttributes = members[0].Attributes.Count();
    for (int i = 0; i < members.Length; i++)
    for (int j = 0; j < cptnbAttributes - 1; j++)
    ((Excel.Range)this.Cells[i + 4, j + 3]).Value2 = members[i].MemberId.MemberType;
    private void DisplayEntityAttributesCombo(ServiceClient c)
    EntityMembers em = GetEntityMembers(c);
    Member[] members = em.Members.ToArray();
    if (members.Count() > 0)
    cbAttributes.Items.Clear();
    foreach (Common.ServiceReference1.Attribute a in members[0].Attributes)
    cbAttributes.Items.Add(a.Identifier);
    cbAttributes.DisplayMember = "Name";
    cbAttributes.Visible = true;
    private void cbMembers_SelectedIndexChanged(object sender, EventArgs e)
    Identifier idMember = (Identifier)cbMembers.SelectedItem;
    EntityMembers em = GetEntityMembers(c);
    Member[] members = em.Members.ToArray();
    Member m = members.FirstOrDefault(p => p.MemberId.Id == idMember.Id);
    cbAttributes.Items.Clear();
    foreach (Common.ServiceReference1.Attribute att in m.Attributes)
    cbAttributes.Items.Add(att.Identifier);
    cbAttributes.DisplayMember = "Name";
    cbAttributes.Visible = true;
    private void cbAttributes_SelectedIndexChanged(object sender, EventArgs e)
    private void btReverseTran_Click(object sender, EventArgs e)
    using (var c = Common.MDS_WSConnect.CreateMdsProxy("yourdomain", "yourlogin", "yourpassword", mdsEndPoint))
    c.Open();
    UpdateTransaction(c);
    DisplayTransactions(c);
    c.Close();
    private void UpdateTransaction(ServiceClient c)
    string versionName = "VERSION_1";
    if (cbVersions.SelectedItem != null)
    versionName = ((Identifier)cbVersions.SelectedItem).Name;
    TransactionSearchCriteria trSrchCrit = new TransactionSearchCriteria();
    trSrchCrit.ModelId = new Identifier() { Name = ((Identifier)cbModels.SelectedItem).Name };
    //trSrchCrit.EntityId = new Identifier() { Name = ((Identifier)cbEntities.SelectedItem).Name };
    trSrchCrit.EntityId = new Identifier();
    trSrchCrit.VersionId = new Identifier() { Name = versionName };
    //ExportView[] ev = c.ExportViewListGet(new International(), out or);
    EntityMembersInformation emi = new EntityMembersInformation();
    int totalTranCount = 0;
    Collection<Transaction> transactions = new Collection<Transaction>();
    OperationResult or = c.TransactionsGet(intl, trSrchCrit, out totalTranCount, out transactions);
    Collection<ReplacementId> transactionReversed = new Collection<ReplacementId>();
    or = c.TransactionsReverse(intl, new Collection<int>() { transactions.First().Id }, out transactionReversed);
    Xavier Averbouch
    Microsoft Community Contributor
    Avanade , FRANCE
    If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful".

  • Adding HTML inside a cell with PDV

    Hi all,
    I got a small problem here: I need to add some HTML code around the data in a PDV cell. The PDV is rendered using a JCO.Table.
    Within the beforePdvExecuteSource(IDataViewer) there are already some methods which change the content of a field but there it's always about adding a link into the field which can be done with IFieldInfoItem.setDisplayType(TableColumnType.LINK).
    Any ideas how to do so?
    thx,
    Paul
    P.S. simply adding it as string would result in s.t. like <b>test</b>
    P.P.S. where can I find the javadoc of com.sapportals.* ?

    Right click the worksheet tab name and select View code to open the VBA editor
    Copy the code below and paste into the VBA editor.
    Edit the line with the comment to the required range where you have the "w" and where the scanned codes are to go.
    Close the VBA editor (Cross with red background top right)
    Save the workbook as Macro Enabled workbook.
    Ensure Macros are enabled in options. See Help fot how to do this. Option to "Disable all with notification" should be ok.
    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim varNewVal As Variant
        On Error GoTo ReEnableEvents
        'Following line edit "A:A" to the required range
        If Intersect(Target, Range("A:A")) Is Nothing Then GoTo ReEnableEvents
        Application.EnableEvents = False
        varNewVal = Target.Value    'Save the new value in the cell
        Application.Undo            'Revert to the previous value in the cell
        If UCase(Target.Value) = "W" Then   'Test if previous value was W
            Target.Value = Target.Value & varNewVal 'Concatenate the previous value and new value
        End If
    ReEnableEvents:
        If Err.Number <> 0 Then
            MsgBox "Error occurred in worksheet module Private Sub Worksheet_Change"
        End If
        Application.EnableEvents = True
    End Sub
    Regards, OssieMac

  • Missing Excel Macro - Didn't save as .xlsm

    So I realized that I didn't save my file as a macro-enabled workbook before I closed it, and now my macro is completely gone.  I haven't shut down the computer since then, and I was wondering if it was still in my computer in a temporary folder somewhere. 
    I already tried going to the PERSONAL in C:\Users\XXXX\AppData\Roaming\Microsoft\Excel\XLSTART and I didn't not find anything there.  Is there anything I can do now, or is that baby gone?  This is Excel 2010

    So I realized that I didn't save my file as a macro-enabled workbook before I closed it, and now my macro is completely gone.  I haven't shut down the computer since then, and I was wondering if it was still in my computer in a temporary folder
    somewhere.  I already tried going to the PERSONAL in C:\Users\XXXX\AppData\Roaming\Microsoft\Excel\XLSTART and I didn't not find anything there.  Is there anything I can do now, or is that baby gone?  This is Excel 2010
    That baby is gone. :(
    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
    Please vote an answer helpful if they helped. Please mark an answer(s) as an answer when your question is being answered.

  • Help Required in Authorization Roles for Workbooks

    Hi All,
    In our project, we have a requirement of creating a role for users with below authorizations.
    1.     Can display and execute the workbooks in the role menu.
    2.     Can create copy workbooks ( Save as) in the role menu.
    3.     Can not delete the original and the copy workbooks from role menu.
    We are using an authorization object S_RS_FOLD with u2018FALSEu2019 for restricting the user from deleting workbooks.
    We also need to add one more object S_USER_AGR (without u2018Deleteu2019 property) to give the authorization of creating copy workbooks in the role menu.
    Object S_RS_FOLD this is working fine without S_USER_AGR. But after adding S_USER_AGR (without delete property), user is again able to delete the workbooks.
    So how can we achieve both the functionalities where user can not delete the workbook but can create copy workbooks in the role menu.
    Thanks,
    Sachin

    Re: Adding report (query & workbook, templates) in roles
    Go through this thread.
    And in our Project we have created one role for accessing workbooks. in that end user can access the work book but saved one and user cannot resave or delete the work book.
    we have added Auth objects S_TCODE and S_GUI.
    in S_TCODE we have added RRMX and in S_GUI we have given 60(IMPORT) access to the users.
    So that they can just share the workbook. nothing else can be done.
    Try like this. Hope this would help you.

  • 'Edit in Place' for XLSM-files (Excel Macro-Enabled)

    Hi,
    is it possible to activate 'Edit in Place' for xlsm-files (Excel Macro-Enabled Workbook file)?
    For xls(x)-files there is the link 'Edit This File', but not for files of type 'xlsm' allthough they could be dealt the same way with Excel.
    I know I can edit this files using the 'Add-in for MS Office' and via the 'Vibe Desktop', but it would be nice to deal them like other Excel-files.
    thx
    Martin

    Originally Posted by mschuhmann
    RTFM helps I admit:
    Novell Vibe 3.3 Administration Guide > Site Setup > Setting Up Site-Wide Customizations > Configuring File Associations for Edit in Place Applications
    Novell Doc: Novell Vibe 3.3 Administration Guide - Configuring File Associations for Edit in Place Applications
    Append ".xlsm" for the variable edit.in.place.file.applet.extensions, edit.in.place.file.webdav.extensions
    Hi Martin,
    Yeah, the Vibe docs can help on occasion
    Still, thanks for feeding it back to the forums as it can be quicker finding a hit in the forums than having to go through the docs!
    Cheers,
    Willem

  • Macros in Work Book

    Hello Gurus,
    i need some information on Macros,i have one report there i want to move "#" kefigure values to upper row, i want to write a macro in workbook to compress the rows,i.e the values in row with Rating type # should be written into the row with Rating type of some value. the row with rating type # should be deleted.
    So please any one provide me MAcro Programme for this compressing row.
    Thanks in Advance,
    Raju

    Hi Raju
    The # can be excluded from teh report without writing a macro.
    Go to the query change mode....go to rating type....restrict data.....select # from the left panel to right panel....right click and select exclude from selection....save the query...
    All the data with # will get excluded.........
    Cheers
    Chanda

  • Workbook is not reflecting changes

    Hi Friends,
       I have done some changes in existing structure at1 existing query and same structure are using in different query also, that also reflected and working fine, but these 2 queries are already added in 1 workbook as in 2 worksheets, the problem is, the changes which I did in query is not reflecting in workbook ( 2 worksheets in workbook ), how do get reflect those queries in workbook. Pls suggest. Thanks.
    Regards,
    CS.
    Edited by: csr_03 on Jul 22, 2010 3:07 PM

    Hi,
    You have made changes to query but those changes do not refelct in workbook automatically.
    Either you need to create new work book by using the modfied query or use the existing workbook and include the modified query again after removing the existing one.
    Workbook is just an excel save file of any exitisng query so you need to save or creat that file again.
    I hope it will help.
    Thanks,
    S

  • Execute Excel Macro Through DIAdem

    Hi All,
      I am currently trying to run a script in DIAdem which exports certain material properties to an Excel Macro-enabled workbook.  Inside the Excel workbook the user executes a macro to perform some calculations.  The results of that calculation will then be re-imported into a DIAdem report.  I have the import/export data part down, but the million dollar question is how can I execute an Excel macro from DIAdem's VBScript?
      I know some are going to say this makes no sense, just do the calculation in DIAdem.  I know this, but the file/calculations are an industry accepted toolbox and it must be done this way. 
      Thanks in advance and here is some dumbed down code to showcase the example:
    Option Explicit 'Forces the explicit declaration of all the variables in a script.
    Dim excel
    Dim excelbook
    Dim a
    Set Excel = CreateObject("Excel.Application")
    Excel.Visible = True
    Set excelbook=Excel.Workbooks.Open("My File")
    excelbook.Sheets("InputResults").range("B5").value = Data.Root.ChannelGroups(ChanGrp#).Properties("myProp").Value
    'Call 'My_Macro' !!!!!!!!!!!!!!!!!!!!
    Msgbox("Result is: " & excelbook.Sheets("InputResults").range("B5").value)
    Solved!
    Go to Solution.

    Hi GT_Mark
    You simply can use the methode Run
    Call Excel.Run("MyMacro")
    Of course you have to make sure that you refer only to data that are available in Excel.
    To obtain CodeCompletion for Excel in the script editor select Microsoft Excel x.x Objects Library in the "Registed Type Libraries" dialog box. The x.x value depends on your installed Excel version.  To open this dialog box, select Script»Type Libraries in DIAdem SCRIPT.
    Hope this helps
    Winfried

  • Best reasonably priced macro lens for a 70d

    Hi i have got a canon 70d and have just started doing alot of macro photography (Flowers bugs etc) i've been using the the 18-135mm kit lens but now i know im enjoying it im going to get a mocro lens. Cant afford nothing to major as saving for wedding and house. Was just looking for some advice on reasonably priced macro lenses. Any Advice welcome..
    Thanks in advance
    Darren 

    amfoto1 wrote:
    Actually, it's hard to go wrong with macro lenses... Most give excellent image quality, so it tends to be the other features that are deciding factors. I have no idea what you consider "reasonably priced".... To one person that might be no more than $100, while to another it might be anything under $1000.
    Canon EF 50/2.5 Compact Macro is currently about $270... As an EF lens, this can be used on both your crop camera and on full frame cameras. But this is a micro motor focus drive lens (slower, hunts more), and on it's own it only goes to 1:2 or one half life size magnification. To get full 1:1 magnification with it, there's a separately sold converter that costs another $270. You also could use macro exension tubes - that sell for between $70 and $200 for a set - to increase the lens' magnification. All the other macro lenses listed here are able to do 1:1 without need for any adapter. 50mm is fairly short focal length, putting you relatively close to your subject. This lens' closest focus is about 4 inches (with 1:1 adapter... compare to 12 inches with a 100mm lens). Personally I use shorter macro focal lengths mostly in-studio where they can work well.... but prefer a longer focal length in the field. Uses 52mm filters. No lens hood offered or supplied, it doesn't really need one because the front element is deeply recessed into the lens.
    SIgma 50/2.8 Macro lens sells for about $350. I don't know much about this lens, it's been around for a while. I know it's 1:1 capable, both crop and full frame capable and has a micro motor focus drive. Comes with a lens hood. Uses 55mm filters.
    Canon EF-S 60/2.8 USM Macro is on sale at the moment for $420. It's an EF-S lens, which will work fine on your 70D, but is not usable on a full frame camera. USM focusing drive is a bit faster, quieter and more precise (see below about focus speed). It's full 1:1 capable, a little longer focal length than 50mm, but not a lot. It's relatively compact and it is "internal focusing" or IF, which means it doesn't change length when focused. It uses 58mm filters and the matched lens hood sells separately for $24 (third party hoods are available for less).
    Tamron  SP 60/2.0 "Di II"  Macro/Portrait lens is selling for about $525 and, like the Canon 60mm Macro, is a "crop only" lens. Fine for your 70D, but not usable on full frame cameras. It's also IF, but using a micro motor type focus drive. I've been working with one of these lately, giving it a try. I find it's focus slower than Canon USM, but generally plenty fast  for most macro/portrait usage. The main attraction of this lens is its f2.0 aperture... fully a stop larger than most other macro lenses (Zeiss makes a couple f2.0 macro lenses, but they are manual focus only and quite expensive). This is nice particularly when using the lens for portraiture. It uses 55mm filters and comes with a lens hood.
    Canon MP-E 65mm is not a lens I'd recommend to anyone just starting out shooting macro. This is an ultra high magnification lens... actually can do no less than 1:1 and goes as high as 5:1. That's a range well beyond what many people shoot. It's also about $1000 and stricly manual focus. It's a superb lens, usable on both crop sensor and full frame cameras, and one I use personally. But it's still not something I'd recommend to anyone just starting to shoot macro. It's rather challenging to work with, pretty much a "tripod only" lens.  Comes with a tripod mounting ring, uses 58mm filters and an odd little lens hood sells separately for around $40.
    Sigma 70mm f2.8 EX DG macro lens.... is another I don't know a whole lot about. Like their 50/2.8 macro, it's been around a long time and uses a micro motor type focus drive. It is the first lens in this list that has a Focus Limiter (2 ranges), which is a feature that can be helpful speeding up auto focusing. It sells for about $470, uses 62mm filters and comes with a matched lens hood.
    Tamron SP 90mm f2.8 Di is another excellent design that's been around a long, long time. I've still got and use manual focus versions of this lens dating back to the 1980s. The currently available micro motor version sells for $500 and, as a Di lens is usable on both crop and full frame cameras. It's got a focus limiter (2 ranges),  uses 55mm filters and includes a matching lens hood. It is not an IF lens.
    Tamron SP 90mm f2.8 Di VC USD is an updated version of their venerable 90mm, now with both an improved AF system (USD is similar to Canon's USM) and image stabilization (Tamron calls it VC). It is said to be better sealed against dust and moisture, and also uses an aperture with 9 curved blades to make for smoother background blurs. This lens is Internal Focusing (IF), has a Focus Limiter (4 ranges!), was introduced within the  last year or so selling for about  $750, uses 58mm filters and comes with a matched lens hood.
    Canon EF 100/2.8 USM is another excellent lens I use personally. This is the older version of this lens without IS (and not L-series, but you would be hard pressed to tell any difference in build quality, comparing it to some L-series such as the 180/3.5L macro). A key feature here is that it can optionally be fitted with a tripod mounting ring.... something that's not possible with most of the other lenses mentioned here. For macro work, I consider a tripod mount a very important feature, though some of the smaller lenses might be fairly usable on a tripod without one. This lens has USM focus drive, is IF, has a Focus Limiter (2 range), sells for about $550 presently, and uses 58mm filters. A matched lens hood is quite large and sells separately for about $40.  Tripod Ring B to fit it sells for about $140 (there are cheaper third party hoods and tripod rings).
    Canon EF 100/2.8 L IS USM is a newer model that primarily is upgraded with the addition of Image Stabilization (IS). Now designated an L, it includes a matched lens hood. Like the older model, a tripod ring can be optionally fitted. It has an improved Focus Limiter (increased to 3 ranges). It uses 62mm filters and is currently on sale for $900. Tripod Ring D sells for $172 (cheaper 3rd party ring is avail.).
    Tokina 100/2.8 ATX is both crop and full frame compatible and sells for about $400. I haven't used it, but it's another venerable design that's been around for a lot of years.  It has a Focus Limiter (2 range), uses 55mm filters and comes with a matched lens hood. I don't believe it's IF.
    Sigma 105/2.8 OS HSM  is currently on sale, heavily discounted, for about $670. I suspect Sigma is about to introduce a new version and that's why they are blowing out the current model with a large instant rebate. It is both crop sensor and full frame camera compatible. The current version has OS, which is Sigma's version of image stabilization, as well as HSM which is similar to Canon's USM focusing drive. This lens has a Focus Limiter (3 ranges), uses a 9 blade aperture, 62mm filters and comes with a matched hood. It cannot be fitted with a tripod ring.
    Canon, Sigma and Tamron all offer longer macro focal lengths... 150mm and 180mm. In general I'd say those are pretty long to use on a crop sensor camera such as your 70D or my 7Ds. They all come with tripod rings, which is good because longer macro lenses can be difficult to keep steady. But they all are also considerably more expensive, so I won't go into the details about them.
    Regarding auto focus speed... All macro lenses with AF are slower focusing for a couple reasons. One is that they have to move their focusing mechanisms a long, long way to go all the way from infinity to 1:1 magnification. Another is by design, they use "long throw" focus mechanisms that emphasize accuracy over speed, which is necessary because depth of field can be quite shallow at high magnifications. So, in general, don't expect a macro lens to offer the same AF speed as a non-macro lens with similar focus drive mechanism. What can help a lot are the type of focus drive and if the lens offers a Focus Limiter. Canon's USM, Sigma's HSM and Tamron's USD all will give faster focusing than micro motor drive systems on other lenses. Properly used, a Focus Limiter can really speed up focusing performance, too.
    When shooting macro, auto focus speed usually isn't all that critical. In fact, I often just focus manually. Accuracy often is more important, due to the shallow depth of field. So AF perfomance might be a bigger consideration if planning to also use the lens a lot for non-macro purposes.
    Image Stabilization (Canon OS, Sigma OS and Tamron VC) is offered on a few premium models. Canon's is a special hybrid version developed just for macro purposes, which most feel is a bit more effective than other forms of stabilization. Nikon actually was the first to put stabilization (they call it VR) on a macro lens, but most agree that while it's useful for non-macro shooting, it is of little practical assistance at 1:1 magnification. The Canon hybrid IS is considered to be a bit better at higher magnifications, but even it will be of limited effectiveness at 1:1. In other words, there may be times when you want to use a tripod or at least a monopod. And in those cases, particularly on some of the larger lenses, a tripod mounting ring can be a very nice thing to have (among all the above, only the Canon 100mm macro lenses can be fitted with a t'pod  ring).
    There are other options to "do macro", too. For example, you could simply get some Macro Extension Tubes to use with your current lens, to make it focus closer. Canon offers quality individual tubes in 25mm and 12mm lengths ($84 and $140 respectively). Kenko does too, but also offers a set of three that includes 12mm, 20mm and 36mm lengths (set sells for $200).  The Kenko are very close to the Canon in design, quality and performance.
    There are also less expensive sets (under $100) from Zeikos and Opteka. The Zeikos set includes 13mm, 21mm and 31mm and sell under a bunch of different brand names (Vivitar, Bower, Dot Line, ProOptic and many more). The Opteka set was just recently introduced and includes 12mm, 20mm and 36mm. All these sets are more plasticky than the Canon and Kenko tubes, but they do support autofocus and direct control of the aperture.
    AFAIK, all the currently sold macro extension tubes for Canon mount are compatible with both EF and EF-S lenses. (If you were shopping used you'd have to be careful because some of the older tubes were EF only and could not be used with your EF-S 18-135mm lens).  
    Canon's TS-E 45mm and TS-E 90mm lenses also are usable for near-macro and, with extension tubes added, macro shooting. These are Tilt-Shift lenses that give additional control over the plane of focus which can be used to good effect with macro and shallow depth of field. I use a TS-E 45mm a lot for table top studio shots of small products. However, these are manual focus only, largely tripod-only and rather pricey lenses, so I just wanted to mention them here. They are probably not something I'd recommend for a first time macro shooter or general purpose, outdoor, walk-around macro work.
    Personally, my two most-used macro lenses are a Canon EF 100/2.8 USM (the older model) and a Tamron SP 60/2.0. When I'm planning to shoot a lot of outdoor, walk-around macro shooting, the Canon lens is my first choice. However, it's rather large so when I'm not planning macro, but want to have a macro lens just in case, I'll substitute it with the much more compact Tamron lens. (Which also can replace two portrait lenses in my camera bag, so reduces my load by one lens serving in place of three.)
    Another key consideration is flash. Often when shooting macro it's a challenge to get enough light to allow a stopped down lens, desirable ISO and adequately fast shutter speed. So you probably will find yourself wanting to use flash sooner or later. Canon offers two macro-specific flashes: the MR14 EX Ring Lite and the MT24EX Twin Lite. I use both for different purposes. I prefer the Twin Lite for macro shots up to about 1:1, maybe 2:1 (double life size) magnification. The Ring Lite I mostly use for very high magnification shots with the MP-E 65mm lens.
    All the Canon lenses above have provision for, or can be adapted to allow for direct mounting of the two Canon macro flashes (Note: I believe there is a new "Mark II" version of the Ring Lite coming out soon). There also are adapters available to mount these flashes on non-macro Canon or onto third party lenses. It also is possible to use a single "standard" flash, along with an off-camera shoe cord and some sort of diffusion to hold back the flash, when shooting macro. I do that often with 550EX and 580EX II flashes.
    There are other macro-specific accessories you may want to consider eventually. Often I'll use a diffusion panel and/or a reflector when out in full sun, to reduce too extreme contrast and help fill too-deep shadows. A focusing stage is another useful thing, when shooting macro with a tripod.
    Finally, I recommend you pick up some books on macro photography. John Shaw's "Close-Ups in Nature" is perhaps the "Bible" among them and likely the most comprehensive. I also found books about macro by Tim Fitzharris and Joe & Mary MacDonald very helpful and interesting. I'm sure there are others, but those came immediately to mind.
    Alan Myers
    San Jose, Calif., USA
    "Walk softly and carry a big lens."
    GEAR: 5DII, 7D(x2), 50D(x3), some other cameras, various lenses & accessories
    FLICKR & PRINTROOM 
    Almost 2,400 words to answer a macro lens post? Alan, nobody can believe you can write so much (except TCampbell, ha ha) but you risk nobody wanting to read. See the link that follows for the sort of difficulty readers have with this sort of post, http://en.wikipedia.org/wiki/Wikipedia:Too_long;_didn't_read

  • Office 2013 update KB 2726958 Problem

    Our pcs applied the latest round of Windows Updates yesterday and the Office Update KB2726958 caused the macros in Excel 2013 spreadsheets to stop working. Uninstalling just this update returned full functionality to Excel.
    These are all Windows 7 64 bit machines connected to an AD domain with 32-bit Office 2013 Professional or Pro Plus.
    Any machine that had applied the latest updates released on Tuesday suffered from this problem. Opening a .xlsm spreadsheet looked fine but users were unable to click on Macro buttons to e.g. load a userform.
    I have spent 28 minutes on the phone trying to speak to somebody, anybody, in Support but no-one was interested so I am trying this forum instead.

    Performing the steps in the link (http://blogs.technet.com/b/the_microsoft_excel_support_team_blog/archive/2014/12/13/forms-controls-stop-working-after-december-2014-updates-.aspx) does
    restore the ability to run button driven macros as well as add controls and buttons.
    However, a task as simple as:
    Creating a new workbook.
    Saving as macro enabled workbook.
    Adding ActiveX form toggle button.
    Adding: msgbox "Toggle this!" to the change even of the newly added toggle button.
    Saving the workbook.
    Everything works great on this machine.
     When the workbook is opened on another machine (I've tried several that can open and use other macro enabled workbooks with buttons and such.), the button appears, but the button and macro are not functional.  Deleting the sheet
    in the workbook causes Excel to crash. 
    Once I uninstalled KB2726958 on the machine where the workbook is created, I am able to perform the above with no issues.  Of course, this is a temporary work around that will be clobbered by policy driven Windows /Office Updates the next time I restart. 
    HALP!
    MrMikeV

  • Can I programmatically force saving an XLTM template to save as an XLSM file in Excel 2010 without defaulting all Excel file types?

    I created an Excel template which includes VB and macros as an EXCEL.XLTM template file (I used a template file to keep users from overwriting the sample template file), but I have noticed that when users save the template, Excel 2010 defaults to saving
    the new file as a XLSX file (removing all the macros).
    I know you can set Excel 2010 to always save as a certain format, but I really would prefer not forcing all Excel files to be macro enabled for the user
    Is there a way to default the Save type to XLSM for this template only?  Like some code that I could put in that when the users saves, it saves as a macro enabled XLSM type only for this template file?
    My users aren't exactly Excel savvy, so I wanted to make it as simple as possible for them.
    Thanks!
    Alan Edwards

    Hi Alan,
    >> Is there a way to default the Save type to XLSM for this template only?  Like some code that I could put in that when the users saves, it saves as a macro enabled XLSM type only for this template file?
    In my option, you could achieve this by adding Application.GetSaveAsFilename Method to the workbook BeforeSave event. Some key code like below:
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Dim FileNameVal As String
    If SaveAsUI Then
    FileNameVal = Application.GetSaveAsFilename(, "Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")
    Cancel = True
    If FileNameVal = "False" Then 'User pressed cancel
    Exit Sub
    End If
    ThisWorkbook.SaveAs Filename:=FileNameVal & ".xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled
    Application.EnableEvents = True
    End If
    End Sub
    But there is a limitation of this workaround, in this workaround, the save as will only support the macro enabled type, other save as types like "xlsx" will be ignored.​
    For more information about Application.GetSaveAsFilename Method (Excel), you could turn to the link below:
    #Application.GetSaveAsFilename Method (Excel)
    https://msdn.microsoft.com/en-us/library/office/ff195734.aspx
    Best Regards,
    Edward
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

  • Excel row height changes when it should not change

    I have a client using Office 2010 on a Citrix server. They are using Windows XP Pro SP3 for the desktop and the server is running Windows Server 2003 R2 STD.
    I have two users working in a spreadsheet in Excel 2010. The spreadsheet opens fine and they can perform their updates by either adding manually or doing a cut and paste. The problem comes up when all of the sudden a number of rows in the spreadsheet
    change height for not reason. The spreadheet has the row height set to 14.5 but for some reason the rows that change height sent the height to 405.9. Usually all the user has to do is go back and reset the row height on these cells and save before they can
    go back to making changes.
    It's more annoying then anything else so if someone could provide any solutions, it would be greatly apppreciated.
    thanks, Joe Trainor
    Joseph Trainor [email protected] Weidenhammer Systems Wyomissing, PA

    I have been working with Excel for 20years, and have been hit with this resizing of row height and also drawings or shapes, after opening an old XL97-2003 file.
    Chad's method below works!
    Please try the following to resolve the issue:
    1. Boot Excel 2010
    2. Open [Excel Options] dialog. ([File]-[Options])
    3. Select [Advanced] tab, turn on [Cut, copy and sort inserted objects with their parent cells] option. (In [Cut, copy and paste] section)
    *This will not resize rows that are currently set to 409.5 but I would like to know if this keeps rows from doing this in the future.
    1) I found that after opening the workbooks the row height and shapes are correct.
    2) Save the file, then save as to the new .xlsx format (for a macro free workbook)
    3) After reverting to former; turn OFF[Cut, copy and sort inserted objects with their parent cells] option. (In [Cut, copy and paste] section), and then opening the XL97-2003 files, the fault is still there.  For the newer xlsx files, though,
    the fault has gone.
    4) So yes, Chad, it does keep rows from doing this in future, if the newer file format is used.  Thanks.
    Chad's answer is "the answer"!

Maybe you are looking for

  • Why does the migration wizard run every time I start up my mac after upgrading to mavericks ?

    After upgrading to Mavericks, I log in as normal but then a migration wizard starts up asking me where I want to import data from and create new accounts. Why and how do I stop it ?

  • (Probably) A stupid playback question:

    I've recently (after purchasing a new PC) cleaned up my external HDs, and put my music collection onto iTunes, for use as a "media" player. I've had iTunes for many years, so, excuse me if this sounds remedial (I just cant figure it out): Why can't I

  • Running vbscript as os command

    Hi All, In a process chain, can I use a process type of OS Command to execute a vbscript (.vbs  file)? I tried this and it did not work. Was wondering if it's even possible to execute any thing other than a .cmd file. Thanks.

  • AJAX call to PageFlow's actions and response

    Hi, in my portlet, I need to do ajax calls for some actions. This works fine but I have a problem with the response. I want to put in the response only a message to be shown to the user (for example "Update successful" or "Error !!"), but WebLogic Po

  • Syntax Check Includes Programmatically

    Hello All, I need to implement the logic of checking syntax for the Includes, Exits to be particular, programmatically. Can anyone let me know the approach in doing it. regards, Mahesh