VBA Excel code-module behavior

I have a situation where the code-module keeps popping up and hiding the worksheet.
I have a worksheet with a button in the toolbar that performs the following actions:
Copy a data-entry section (a fixed sized number of columns wide and rows deep) to an area just below the original in the worksheet (and any additional areas below that one, etc.)
Copy a ‘calculate’ button from beside the first data-entry area to beside the new data-entry area in the worksheet (for each new data-entry area, etc.)
Create a new button-click event for the new ‘calculate’ button (in the code-module of this same worksheet as the buttons)
This is all working well…except for the irritating fact that, when the new event is created the code module is brought to the foreground and hides the data-entry worksheet.
Is there some way to prevent this display of the code-module?

Hi Michael,
This is the default behavior if you use VBA code to create the click event handler of the button. The VBE window will be activated. One solution is to hide the VBE window and activate the workbook window, for example:
Sub Test()
'Activate the workbook
Workbooks("D:\test.xlsm").Activate
'Hide the VBE window
ThisWorkbook.VBProject.VBE.MainWindow.Visible = False
End Sub
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.

Similar Messages

  • Copying Graphs and Pie Charts generated in Analysis View to Email item using Excel VBA Macro Code

    Hi
    I am currently working on an exce VBA macro code that would help me take snapshots of the Graphs and Pie charts generated in QC for a particular application and copy the same to an email item using excel VBA macro code.
    I was able to write the code to create an email item. But I have no clue of how i can take snapshot of the graphs in Analysis View using excel VBA
    Any help would be highly appreciated.
    Thanks in Advance
    Regards
    Amit

    useramit,
    You are in the consumer end products forum.  You will also want to ask your question over at the Enterprise Business Community.
    Click the plus sign (+) next to Discussion Boards to drop down all the options for servers, networking and any other professionally related problems.
    http://h30499.www3.hp.com/

  • Save as PDF file as excel file or text file in vba excel

    Hi all,
    I am opening a PDF document fromm VBA excel. After opening document it should save the document as excel file or text file in one folder.
    I am trying to do this with some code but not able to , pls help me thatnks.
    Dim AcroApp As Acrobat.CAcroApp
      Dim Part1Document As Acrobat.CAcroPDDoc
    Set Part1Document = CreateObject("AcroExch.PDDoc")
       Part1Document.Open ("Z:\EG MI Information\MIS\Requests\Req_156\NO.1.pdf")
      Dim app As Object, avdoc As Object, pageview As Object
    Set app = CreateObject("AcroExch.App")
    Set avdoc = app.GetActiveDoc
    app.MenuItemExecute ("SaveAs")
    thanks
    Abhijeet

    Hi,
    In the documentation for the saveAs function it has the following params
    cPath The device-independent path in which to save the file.
    cConvID (optional, Acrobat 6.0) A conversion ID string that specifies the conversion
    file type.
    cFS (optional, Acrobat 7.0) A string that specifies the source file system name.
    bCopy (optional, Acrobat 7.0) A Boolean value which, if true, saves the PDF file
    as a copy. The default is false.
    bPromptToOverwrite (optional, Acrobat 7.0) A Boolean value which, if true, prompts the user if
    the destination file already exists. The default is false.
    In order to get a text file saved you need to specify the correct cConvID.
    See the documentation for the valid convID's - http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/JS_API_AcroJS.88.519.html
    Please note the Acrobat SDK contains all the information and does not require much installing ( as it is a zip file(on windows) and a disc image (on Mac) it just needs extracted)
    Regards
    Malcolm

  • Teststand Manager Controls in Code Modules

      I am trying to understand how UI controls work in code modules called by TestStand steps.  I can pass a reference to an Application Manager (perhaps the application manager?) to my code module using RunState.engine.GetInternalOption(InternalOption_ApplicationManager).  Does the sequence editor have an application manager?  Or the engine?  Is this the same as the Application Manager control I put on the front panel of the code module?  What about SequenceViewManagers and ExecutionViewManagers?  Can I create those in my code modules to display sequences or executions?  Or can I somehow get those from the sequence editor/engine, or from the Application Manager?
    I know that I just asked a lot of questions, but I guess what I am looking for is some general guidelines for using the manager controls in code modules.  This all came about by an attempt to display an Execution View Manager control in my code module.  Feel free to ignore the following description of my various attempts to get this to work.  This exercise helped me understand the managers a little bit more, but I'm still a little confused.
    Suppose I want to create a custom step type for debugging to display the variables for the current sequence context on the front panel of a code module VI.  (LabVIEW 8.6, TestStand 4.1.)  In my code module, I call ExecutionViewMgr.ConnectVariables to connect to a VariableView control.  Where do I get my ExecutionView Mangager from?  I tried two methods:
    1) create an ExecutionViewManager control; set the manager's current execution using ExecutionViewMgr.Execution (pass RunState.Execution from TestStand to the code module).
    It seems like this should work, but when I run my sequence from the sequence editor, the ExecutionViewMgr.Execution property node returns error -17500.
    When I run from a LabVIEW Operator Interface (using the LabVIEW environment, not the exe), I don't get an error.  But I must connect a list control using ExecutionViewMgr.ConnectExecutionList, and select the execution from the list when the code module is running.  Then I can see the variables when I select the execution in the list.  However, the execution display on the OI goes blank.  I can see either the variables on my code module or the execution on my OI, but not both simultaneously.  It appears that an execution cannot be attached to more than one manager at once (I guess that's reasonable).
    2) pass the result of RunState.engine.GetInternalOption(InternalOption_ApplicationManager) to the code module; set the manager's current execution using ApplicationMgr.GetExecutionViewMgr() (pass RunState.Execution from TestStand to the code module, then as a parameter to GetExecutionViewMgr() ).
    In this case, I would expect that there is no ExecutionView Manager associated with the execution when running from the sequence editor.  But the ApplicationMgr.GetExecutionViewMgr() function returns a non-Null reference.  ExecutionViewMgr.ConnectVariables() causes an error dialog to be displayed (from the function itself, not from TestStand), although it doesn't actually output an error (and the VariableView control remains blank).  The error is "Unable to connect Variables View control."  (See attachment.)
    When I run from my LabVIEW OI, it works perfectly--I see the variables on my code module's UI, and the execution appears on the OI simultaneously.  I guess this makes sense since the TestStand engine is returning the Execution manager that was already created by the OI.
    Attachments:
    Error Dialog.PNG ‏20 KB

    TestStand only allows a single ApplicationMgr per process, creating a second one will error. So the engine will always return the one in either the UI or the Sequence Editor. Events should be seen by both handlers. You have to be careful to ensure that your extra handler does not mess up the UI's handler if yours is called first, like preacknowledging a message. As far as setting up a handler in a code module, you should be able to. However, we have not fully tested this capability, so we cannot say that we fully support this because you might run into issues. In addition, using LabVIEW might present additional issues that might not be seen in other development environments like CVI and Visual Studio. Performing some functionality that can process messages in a COM callback can cause potential hang conditions, to the less you do in a callback the better when using LabVIEW. Keep in mind that you have to ensure that you unregister your handler if the code module returns to the calling execution and you no longer want the handler to be called.
    Attempting to use a new TestStand UI control in a different thread than the UI thread is not recommended because we have done almost no testing on this use case because it is not done in typical UIs.
    Now, for customers that want to create a nice GUI that includes serial number prompting, but still want to be able to work with the Sequence Editor, I suggest that you implement a behavior that works with a supporting GUI, but support an alternative when a non-supporing GUI is present.
    For example, you could do the following:
    1. The process model can send a custom UI message synchronously to the GUI to ask for a serial number. The custom message would contain a reference to a property that contains (a) a boolean to indicate that the UI will "respond" to the message, (b) a string for specifying the serial number, and (c) a notification object from the TestStand Synchronization Server.
    2. When receiving the UI message, a supporting UI will set the boolean to True, duplicate the reference passed locally, and acknowledge the UI message.
    3. When the UI message returns, the exectution will determine if the UI supports the message. If yes, the exectution will (a) wait on the notifcation (b) When the user enters a serial number, the GUI will set the string property and then pulse the notification, and release the reference to the properties passed via the UI message. (c) The execution will return from the notification wait, read the serial number, and continue execution.
    If no, the execution will need to use the default process model prompting or custom prompting that you devise when using the Sequence Editor.
    The process model could use a UI message to determine if the GUI is supportive of this mechanism once instead of with each serial number prompt, but you get the idea.
    Scott Richardson
    National Instruments

  • Is it possible to launch the SequenceAnalyzer from a C# code module in a Custom TestStand Editor

    The Sequence Analyzer is not available in the Custom TestStand Editor Mode GUI.
    Is it possible to add the Sequence Analyzer to a menu in the custom TestStand Editor?
    Is it possible to launch the sequence analyzer from a C# code module, this method is then called from a sequence call back.
    Best regards
    Patrick

    From the TS Help:
    TestStand Sequence Analyzer Application
    Select Start»All Programs»National Instruments»TestStand»Tools»TestStand Analyzer or run <TestStand>\Bin\AnalyzerApp.exe to launch the stand-alone TestStand Sequence Analyzer application. Use this application to analyze projects outside of the TestStand Sequence Editor.
    The sequence analyzer application window contains the following tabs:
    Files—The files and directories to analyze.
    Rules—The rules to use for analysis. Use this tab to enable, disable, and configure rules for analysis in the current project.
    Options—Contains the project options that control the analysis and determine whether the sequence editor automatically saves the current analyzer project.
    Messages—Contains the list of messages for the most recent analysis of the current project, sequence file, or workspace file. The sequence analyzer overwrites the content of the Messages tab each time you start an analysis session.
    Analysis Summary—Contains a summary of the most recent analysis of the project.
    Command-Line Usage
    You can use the following command-line syntax to open an analyzer project:
    AnalyzerApp.exe "C:\My Documents\MyProject.tsaproj"
    CTA, CLA, MTFBWY

  • How to generate passwordDigest and nonce in VBA excel ?

    Hi All,
    I need to consumme a webservice in VBA Excel. I need to generate a passwordDigest in order to fill this XML:
    <SOAP-ENV:Header>X-WSSE: UsernameToken Username="MYUSERNAME", PasswordDigest="???PasswordDigest???", Nonce="???Nonce???", Created="2015-01-15T20:19:45Z"</SOAP-ENV:Header>
    How can I generate a passwordDigest and Nonce in VBA EXcel in order to consume the webservices ?
    Thank you for your help,
    best regards

    Hi,
    This is the forum to discuss questions and feedback for Microsoft Office, your issue need some VBA DEV, I'll move your question to the MSDN forum for Visual Basic for Applications
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=isvvba
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Use the same code module for several steps in the sequence

    Hello All,
      I have been trying to set up a sequence that uses the same code module for all of the steps in the sequence, but am having trouble referring back to it when I need to send it commands.  I have gotten as far as calling the VI in a new thread so that it can be run asynchronously.  I can run the simple sequence and it will indeed open the VI, and move on to the next step.  When I close the VI manually from the front panel, the sequence in TestStand completes, as expected.  So it appears that I have that much working. 
      My question is how to call the separate thread from the main sequence or other sub sequences when I need to edit the parameters.  If I insert an Action step, I am required to select a VI file, but from what I can tell, it opens a different instance of the file, and does not provide an interface with the other instance running asycronously.  My next guess was to use a Statement step, but I was not able to figure out how to configure the lookup string to call the VI parameters.  Beyond that, I'm not sure how to proceed.  Please advise.   
      My intention is to start the code module VI (asynchronously), run several different subsequences within the main sequence that call that same VI and edit it's parameters, close everything and report on the results.  If I am misunderstanding how TestStand is supposed to work, please let me know. 
    Thanks,
    GSinMN    
    Solved!
    Go to Solution.

    What I do is use a Queue to send data to the asynchronous VI.  So it can run and do whatever, but also recieve the commands from the queue.  I use an Action Engine that holds the queue reference and sends the commands.  So you really just have to call the Action Engine from your sequences.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Calling a Configuration Entry Point from a C# code module

    Hi,
    Is it possible to call a configuration entry point from a C# code module?
    I have a custom process model which creates some configuration entry points.
    One of the entry points, calls a C# method in a code module to display a Startup screen for the operator.
    In an Editor User Interface, I have added a toolbar, now I want to execute the previous entry point initiated from my C# code to get the Startup screen again when a button is clicked on the toolbar.
    Best regards

    Hi James,
    Thanks for your suggestion, but unfortunely the code hangs after executing the entrypoint, if have tried it in two ways, but both have the same result. Do you have any idea how to fix this.
    Trial 1:
      Engine engine = new Engine(); ApplicationMgr applicationMgr = (ApplicationMgr)engine.GetInternalOption(InternalOptions.InternalOption_ApplicationManager);EntryPoints entryPoints = applicationMgr.ConfigurationEntryPoints; int intIndex = 0;foreach (EntryPoint entryPoint in entryPoints) {    switch (entryPoint.Name.ToUpper())    {        case "TOGGLE ONLINE <-> OFFLINE":            object objEditArgs = System.Type.Missing;           entryPoint.Run(objEditArgs); // Application hangs after executing this command, the entrypoint does not execute!             break;        default:            break;     }
         intIndex++;
    Trial 2:
      Engine engine = new Engine(); ApplicationMgr applicationMgr = (ApplicationMgr)engine.GetInternalOption(InternalOptions.InternalOption_ApplicationManager);EntryPoints entryPoints = applicationMgr.ConfigurationEntryPoints; int intIndex = 0;foreach (EntryPoint entryPoint in entryPoints) {    switch (entryPoint.Name.ToUpper())    {
            case "TOGGLE ONLINE <-> OFFLINE":           // Application hangs after executing next command, the entrypoint does not execute!           applicationMgr.GetCommand(CommandKinds.CommandKind_ConfigurationEntryPoints_Set, intIndex).Execute(true);              break;        default:            break;     }
         intIndex++;
    Best regards

  • It is possible to programmatically disable the "Executing Code Modules in an External Instance of CVI" feature?

    It is possible to programmatically disable the "Executing Code Modules in an External Instance of CVI" feature within a CVI project?
    I know how to do it manually (Configure > Adapters... > Adapter Configuration).
    Thanks in advance,
    --M

    Yes. TestStand 2.0 added the Engine.CVIAdapter_ExecuteStepsInCVI property.

  • ABAP: Can I reproduce this Excel code in ABAP?

    Hi Experts,
    I've got a process that I want to improve using ABAP code so that I can reduce user interaction. I have a table (SKAS) on the ECC side that contains some data that I need to report on within BI. I am currently exporting this to a flat file, doing string manipulation in Excel, and then importing it into BI using a File type datasource.
    The problem with this is that I constantly have to do this maintenance for the simple task of adding another field (from the string manipulation) to the table. Is there a way that I can do this using ABAP, so that I can build an extractor for SKAS and then set a transformation to DSO level and add the field there.
    Here is my code in Excel:
    =IF(ISERROR(LEFT(A318,FIND("CTY",A318)-1)),A318,LEFT(A318,FIND("CTY",A318)-1))&IF(ISERROR(RIGHT(A318,LEN(A318)-FIND("CTY",A318)-3)),"",RIGHT(A318,LEN(A318)-FIND("CTY",A318)-3))
    Any questions about the code, please let me know.
    Thanks!

    Brian - for a non abapper the simplest way to do this is create a generic data extractor based on a view of the SKAS table
    then in transformations use the forumula builder to replicate your excel code
    True you could do it in abap and normally I would if it were me - but the transformation builder is very very similar to the way you have built your excel forumula - ie it contains IF and LEFT and STR functions

  • Change name of parameters output by code module

    Hi guys,
    I am calling this  code module everytime but pass different parameters as input  & get different results
    I want to customize the  Parameter Name  for the output parameters as they get saved in my report.
    & so I can be very specific.

    Hi,
    I think it is not an option or configuration in TestStand. You can try to change the parameter name in the code module.
    Have you tried this?
    best regards
    Richard

  • Creating variables/parameters from a code module that persist when the sequence is over

    I am creating variables/parameters programmatically in a code module (C#) by passing in the Locals object and calling the method 'NewSubProperty'.
    I've also tried SetValNumber with PropOption_InsertIfMissing.
    But it seems they are only being created in that instance of the sequence, because they are gone when the sequence is over. I really wanted them to persist.
    I wanted to avoid creating station globals dynamically like this, but maybe that's all I can do to make them last.
    Any ideas would be gratefully appreciated.
    Thanks,
    Ronnie
    TestStand 4.2.1, LabVIEW 2009, LabWindows/CVI 2009
    Solved!
    Go to Solution.

    Hi,
    Check out the links on this response
    http://forums.ni.com/ni/board/message?board.id=330&message.id=11226&query.id=267719#M11226
    It maybe of help
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • I am trying to debug HTBasic code modules while using Test Stand, how do I refresh the subs that have been loaded in memory?

    I am writing an application for Test Stand, we are using modules previously written in HTBasic. Whenever I make a change to the code and try to re-run the program, it just runs the old version of the code. The only way to refresh the code is to close Test Stand down and restart it. Is there a way to flush the memory of modules?

    Hi,
    I haven't used HTBasic with TestStand 2.0.x, but I'm assuming that you have the steps in the sequence set to unload when sequence file is closed (look under the step properties -> run options tab).
    If you're still prototypeing, use the File->Unload all modules option. Have a look at page 4-3 in the user manual - it refers to .DLLs, but I'm assuming the HTBasic falls into the same methodology.
    Altering the run options from it's default will affect the memory useage and speed of execution of the test sequence. Have a look at page 5-22 (page 158 in the .pdf) in the TestStand user manual - basically, if a code module is loaded into memory already, when the step gets to execute, the loading overhead is already done. If it stays in memory after this, then it's avail
    able for next time (quicker second run 'cos it doesn't need to load again. However, the balanceing factor is the sequence is useing more memory at a time, by haveing the module ready.
    My usual setting is to use Load dynamically, and Unload after sequence executes. I use this is only during development however, as this is not the most speed friendly, but a compromise so that if I don't call a step I don't load it, but if I do use a step, I'm sure it's free again when I need to modify the .dll modules I create. If you have a look on page 5-7 (143) of the user manual you can set the sequence file to effectively over-ride each step's load and unload settings - useful if you want to revert back again later. If you use this, you'll see that the top two run options for the step are greyed out, but if you set it back with the sequence file options, they do revert back to their original settings.
    Hope that helps (and works!!)
    S.
    // it takes almost no time to rate an answer

  • Compare two sequences loaded in a C# code module.

    Hi,
    Is it possible to compare two sequences loaded in a C# code module using functionality from the TestStand API?
    Best regards

    Hello,
    Here you can find a related post:
    http://forums.ni.com/ni/board/message?board.id=330&message.id=26058&requireLogin=False
    Let me know if you have further questions or if this doesn't help you.
    Kind Regards,
    Thierry C - Applications Engineering Specialist Northern European Region - National Instruments
    CLD, CTA
    If someone helped you, let them know. Mark as solved and/or give a kudo.

  • Add StationGlobal, FileGlobal and Locals from a C# code module

    Is it possible to create StationGlobal, FileGlobal and Locals from a C# code module?
    I know it is possible to get and set variables using PropertyObject, but as far as I know it is not possible to create them.
    Best regards

    The easiest way is to use the PropOption_InsertIfMissing option with the SetVal* methods.
    Be careful if you have multiple threads accessing the variables at the same time though because if you are creating and deleting variables dynamically while accessing/creating/deleting them from other threads it can lead to race conditions (i.e. crashes and memory corruption). If you need to access the variables from multiple threads at once, I'd recommend creating all the variables upfront, if possible, in the first thread, before any other threads try to access them, otherwise you will need to use a Lock step or step setting to protect access to the variables and any parents variables of variables you are inserting or deleting.
    Hope this helps,
    -Doug

Maybe you are looking for