Consolidating MSP Files using a variable as the filename

Hi All
I am trying to consolidate a number of MSP Files without having to hardcode the filenames.  Here is what I have so far and it is falling over on the Application.ConsolidateProjects..... line.  Any help/advice would be appreciated:
Sub ImportWorkstreamPlans()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim i As Integer
Dim Path As String
Application.DisplayAlerts = False
'Create an instance of the FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object
Set objFolder = objFSO.GetFolder("D:\Delivery Assurance\CPP Build")
i = 1
'loops through each file in the directory and prints their names and path
For Each objFile In objFolder.Files
'FName = objFile
Application.ConsolidateProjects Filenames:=objFile, NewWindow:=False, AttachToSources:=False, HideSubtasks:=True
ViewApply Name:="CPP View"
GroupApply Name:="No Group"
SelectRow Row:=1, RowRelative:=False
Next objFile
FilterApply Name:="All Tasks"
OutlineShowAllTasks
SetAutoFilter FieldName:="Flag3", FilterType:=pjAutoFilterIn, Criteria1:="Yes"
GroupApply Name:="Sub Project"
Application.DisplayAlerts = True
End Sub
Thanks in anticipation.
Tony
TKHussar

Tony,
I think you made a typo when you say your individual plans are stored in "D:\CPP Build Template\CPP Plans" because your code is looking for the files in "D:|CPP Build Template\CPP
Build Plans". Maybe that's your runtime error right there.
However, I have to take back something I said previously. The FileName parameter of the ConsolidateProjects Method can, and should in this case, be a full path. I did a little further testing to simulate your configuration. I have a "Y" drive with
a desktop folder. I created a blank Project 2010 template file and a simple test file and placed both of those on the "Y" drive desktop. I am running Project 2010 on the "C" drive of Windows 7 on a virtual PC. The macro code below is in
the Global file. I open the template file and then run the macro. Everything works fine until it attempts to invoke the autofilter. Then it fails and I didn't have time to figure it out so I use a normal custom filter instead.
Sub ImportWorkstreamPlans()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim i As Integer
Dim Path As String
Dim FName As String
Application.DisplayAlerts = False
'Create an instance of the FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object
Set objFolder = objFSO.GetFolder("Y:\Desktop")
i = 1
'loops through each file in the directory, determines if they are a project file, and then inserts them into a static master
For Each objFile In objFolder.Files
    If InStr(1, objFile.Path, ".mpp") > 0 Then
        FName = objFile.Path
        Application.ConsolidateProjects Filenames:=FName, NewWindow:=False, AttachToSources:=False, HideSubtasks:=True
        ViewApply Name:="Gantt Chart"
        GroupApply Name:="No Group"
        SelectRow Row:=1, RowRelative:=False
    End If
Next objFile
    OutlineShowAllTasks
    FilterApply Name:="All Tasks"
    FilterEdit Name:="TKH", taskfilter:=True, create:=True, overwriteexisting:=True, _
        FieldName:="Flag3", test:="equals", Value:="yes", ShowInMenu:=False, showsummarytasks:=True
    FilterApply Name:="TKH"
    'SetAutoFilter FieldName:="Flag3", FilterType:=pjAutoFilterFlagYes
    GroupApply Name:="Sub Project"
Application.DisplayAlerts = True
End Sub
John

Similar Messages

  • Using a variable as the comparison set with the IN clause

    I am attempting to use a variable as the comparison set in an IN clause:
    if <var> is not null and <var> in (<variable>) then ...
    if <var> = 'X' and <variable> = 'X','Y' this statement evaluates to FALSE. If, however, I write
    if <var> is not null and <var> in ('X','Y') then ...
    the statement evaluates to TRUE. Is there a way to force evaluation of a variable prior to executing the statement?

    Kumar
    That is neat trick and an good example of lateral thinking. However, there is a slight problem with it in that this is true:
    instr('1APC2', 'APC')
    whereas this is false
    'APC' IN ('1APC2')
    However, it did inspire me to produce an even neater trick:
    create or replace function my_in
    (in_value IN varchar2, in_string_list IN varchar2)
    RETURN boolean
    AS
    larray_string DBMS_UTILITY.uncl_array;
    ln_count INTEGER;
    return_value BOOLEAN := FALSE;
    lv_comparator VARCHAR2(4000);
    BEGIN
    DBMS_UTILITY.comma_to_table(in_string_list, ln_count, larray_string);
    FOR rownum IN 1..ln_count
    LOOP
    IF larray_string(rownum) = in_value
    THEN
    return_value := TRUE;
    EXIT;
    END IF;
    END LOOP;
    RETURN return_value;
    END;
    Note that the in_string list parameter must be COMMA separated, and spaces will be treated as values. Hence
    declare
    lb boolean;
    begin
    lb := my_in('APC', 'DEF,APC,ABC');
    if lb = TRUE
    THEN
    dbms_output.put_line('FOUND');
    else
    dbms_output.put_line('NOT FOUND');
    end if;
    lb := my_in('APC', 'DEF, APC, ABC');
    if lb = TRUE
    THEN
    dbms_output.put_line('FOUND');
    else
    dbms_output.put_line('NOT FOUND');
    end if;
    end;
    produces the following output:
    SQL> @tstrun
    FOUND
    NOT FOUND
    PL/SQL procedure successfully completed.
    SQL>
    Kindest regards, APC

  • How to use bind variables in the following query

    CREATE OR REPLACE PROCEDURE MMDB.test IS
    sel_qtn VARCHAR2 (10);
    CURSOR PT_QUANTITY IS select * from mmdb.product_tree WHERE QUANTITY_CHECK ='E'
    AND run_id = 100
    a PT_QUANTITY%ROWTYPE;
    BEGIN
    FOR i IN PT_QUANTITY
    loop
    sel_qtn := i.quanttity-1;
    While sel_qtn>=1
    loop
    insert into mmdb.product_tree (BILLING_ACCOUNT_NO ,S_CODE) values (i.BILLING_ACCOUNT_NO ,i.S_CODE||'E');
    sel_qtn :=sel_qtn -1;
    End loop;
    commit;
    end;

    Don't duplicate threads: How to use bind variables in the following query

  • Creating variables in Process Flows and using thse variables in the filter

    Hi,
    I am new to OWB and in learing stage. Need to information.
    *1. as to how pass/create/use variables to OWB mapping ?*
    *2. Creating variables in Process Flows and using thse variables in the filter operator of the OWB mapping?*
    *3. Other mechanisms of how to create/use variables within OWB mapping itself ?*
    can you please provide the above details and guide me / help me in this regard.
    Thanks,
    skms.

    1. Add parameters to your mapping using the MAPPING INPUT PARAMETER from the pallette.
    2. Add parameters to the START operator in the process flow. Bind the process flow parameter to the Mapping parameter.
    3. May be appropriate to use CONSTANTS instead of parameters.
    Regards
    Si

  • Use a variable for the integer in Fmt offset modifier

    I'm trying to pluck values out of a long array of comma separated string
    values.
    I'm doing this within a loop and would like to use the loop interation to
    point to the starting point in the array.
    Here's what I have working so far:
    Fmt (scratch,"%s<%s[i0t44]",transmitBuf);
    Works great.
    Now if I go in and change i0 to i3 then my modifier doesn't start looking
    for a comma "," until after the 3rd character. Still working great. However....
    If I try to use an integer called "loop" instead of the literal offset
    value it blows up:
    Fmt (scratch,"%s<%s[iloopt44]",transmitBuf);
    Is there a way that I can use a variable for the integer portion of the
    offset modifer?
    Thanks All!

    Hi Roberto
    Thank you. I actually need to use a symbolic value for the interger section of the modifer vs. the specifier.
    So, in my example:
    Fmt (scratch,"%s<%s[i0t44]",transmitBuf); 
    I want to make the following substitution (Assume z=0)
    Fmt (scratch,"%s<%s[izt44]",transmitBuf);
    Some background...
    I'm looking to loop index through a long CSV string array (transmitBuf) that looks like this:
    1,PEEP,7,6,,,21,20,
    So on my first loop when I use the following:
    Fmt (scratch,"%s<%s[i0t44]",transmitBuf); 
    scratch = "1"
    ... Perfect. I now do a string length of scratch (which equals 1)
    and add 1 to it, I'm ready for my next loop which would
    literally read like this:
    Fmt (scratch,"%s<%s[i2t44]",transmitBuf); 
    However, I want to put this inside a loop, so I would like to
    increment a variable (++z) and use the following:
    Fmt (scratch,"%s<%s[izt44]",transmitBuf); ---- Ka-Boom!
    So it's the use of the variable in the modifer that blows up
    the Fmt command.
    appreciate any thoughts...
    Thanks
    Mark

  • Using attribute variables in the planning folders

    Hi all,
    Is there way to use attribute variables in the planning folders?
    There is a following situation. We have a number of cost centers (0COSTCENTER). Cost center has responsible person (0RESP_PERS) as attribute.
    We planning some costs for cost center.
    To select certain cost center to cost planning we created
    variable ZVAR1 as type CHAR and placed this variable in the header of planning folder.
    Now we have to restrict list of cost center for selection according to selected responsible person.
    Of course, I can add 0RESP_PERS to my cube, create variable ZVAR2 as type CHAR based on this character. Then place this variable to folder. For variable ZVAR1 use type of replacement as "User Exit" and ABAP routine will restrict list of available cost centers based on value of ZVAR2.
    But... Is there way to use variable with type of attribute and place this variable to header of folder?
    Thanks in advance!

    Hi Dmitry,
        Yes, you can use the attribute variable in your folder.
        Just create attribute variable with 0COSTCENTER as the basic char and 0RESP_PERS as attribute.then when you create your folder with UPSPM, make sure to choose notweb-enable type then under the variable category you will see the the attribute vairable you just created at BPS0, just drug it to you folder, you are done.

  • Code hints don't work - include files using a variable

    In Dreamweaver CS 5.5 code hints didn't work properly.
    DW would not look at my code and find the include files and look at the functions inside them when using a variable to make an absolute path, which is the best way to include files in PHP (its faster and more reliable on your web server)
    Here is an example:
    ======================================
    public_html/util/util_index.php
    $DIR_MAIN            =dirname(dirname(__FILE__).'../');
    require_once "$DIR_MAIN/init.php";
    my_function(#CODE COMPLETE DOES NOT WORK HERE
    public_html/init.php
    $DIR_INCLUDE=               "$DIR_MAIN/inc";
    require "$DIR_INCLUDE/common_functions.php";
    #set up environment variables
    #connect to the database
    #etc
    public_html/inc/common_functions.php
    function my_function(param1, param2, param3) {
    =======================================
    Has this been fixed in Dreamweaver CS6 or should I wait until CS7?
    Until this works, I prefer Notepad++

    I made a full SQL Developer installation with Java included, so I suppose that the included version is used.
    After a problem with the German Version I tried to switch to English Version by using the hint:
    link: 1.5.4 export insert statements
    I changed the content of sqldeveloper.conf and now again the code templates (strg-shift-t) don't work!!!
    (I already rebooted and set the accelerators to default, but it didn't help now.)
    This is the content of my sqldeveloper.conf now:
    "IncludeConfFile ../../ide/bin/ide.conf
    AddVMOption -Dapple.laf.useScreenMenuBar=true
    AddVMOption -Dcom.apple.mrj.application.apple.menu.about.name="SQL_Developer"
    AddVMOption -Dcom.apple.mrj.application.growbox.intrudes=false
    AddVMOption -Dcom.apple.macos.smallTabs=true
    AddVMOption -Doracle.ide.util.AddinPolicyUtils.OVERRIDE_FLAG=true
    AddVMOption -Dsun.java2d.ddoffscreen=false
    AddVMOption -Dwindows.shell.font.languages=
    AddVMOption -XX:MaxPermSize=128M
    IncludeConfFile sqldeveloper-nondebug.conf
    AddVMOption -Duser.country=US
    AddVMOption -Duser.territory=US
    AddVMOption -Duser.language=en
    "

  • Using environment variables in the JAR manifest

    Hello,
    I need to make a JAR which uses some third party libraries located in the file system, in a path referenced through a environment variable (named for example ENV_VAR). Without using the JAR the application may be started by running:
    java -classpath %ENV_VAR%\lib\library1.jar;%ENV_VAR%\lib\library2.jar MyApplication
    So what is the syntax to refer to environment variable inside the manifest?

    I guess its not possible. If you look at the [Manifest specification|http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html#JAR%20Manifest] there is nothing that inidcates that environment variables can be used. The classpath attribute is specified as follows:
    The value of this attribute specifies the relative URLs of the extensions or libraries that this application or extension needs. URLs are separated by one or more spaces. The application or extension class loader uses the value of this attribute to construct its internal search path.
    So actually, if it would be possible the ENV_VAR pathes must be set relative to your application .jar file.
    Why not just use a batch that sets up your command line as in the example and runs your app?

  • Send email from workflow using a variable in the to field in SharePoint Online (Office 365)

    I have a simple sharepoint workflow that sends and email to users.  I know that the mail portion works because I can put a user's email address in the to: field and it sends fine.  If I use a string variable with the email address, I get a workflow
    error.
    Simple steps to repro for me:
    Create a new workflow in SPD  (I have tried a list workflow and site workflow)
    Create a workflow variable named email.
    Set the variable to an email address where the user is in the site
    Send email and do a variable lookup to the email variable just set.
    The workflow just hangs in this scenario
    I do get an error:
    Retrying last request. Next attempt scheduled in less than one minute. Details of last request: HTTP BadRequest to https://[tenant].sharepoint.com/_api/sp.utilities.utility.SendEmail
    Correlation Id: 568e9c68-ea75-d057-ab9f-d86f6cae3021 Instance Id: 9cc721a4-78e6-456f-812b-67351dfc9710
    The e-mail message cannot be sent. Make sure the e-mail has a valid recipient.
    Retry now

    Simple answer... When I used the variable, I marked it as a string.  There is an email address setting.

  • How to use presentaion variable in the SQL statement

    Is there any special syntax to use a presentation variable in the SQL Statement?
    I am setting a presentation variable (Fscl_Qtr_Var)in the dashboard prompt.
    If i set the filter as ADD->VARIABLE->PRESENTATION, it shows the statement as 'Contract Request Fiscal Quarter is equal to / is in @{Fscl_Qtr_Var} '.
    And this works fine but when i convert this to SQL, it returns
    "Contract Request Date"."Contract Request Fiscal Quarter" = 'Fscl_Qtr_Var'
    And this does not work.It is not being set to the value in the prompt.
    I need to combine this condition with other conditions in the SQL Statement. Any help is appreciated. Thanks

    Try this: '@{Fscl_Qtr_Var}'

  • Using a variable for the "format" parameter for disk/directory name

    In the interest of maintainability, I'm trying to use an environment variable in the format parameter. I've found that RMAN is able to interpret the $ORACLE_HOME and $ORACLE_BASE variables, but others give the error:
    RMAN-03006: non-retryable error occurred during execution of command: backup
    RMAN-07004: unhandled exception during command execution on channel t1
    RMAN-10035: exception raised in RPC: ORA-07217: sltln: environment variable cannot be evaluated.
    RMAN-10031: ORA-19583 occurred during call to DBMS_BACKUP_RESTORE.BACKUPPIECECREATE
    Is there any more specific documentation about what variables are supported within RMAN? (I've found nothing in the manuals beyond the excerpt I included below.) Does anyone know if the "port-specific directory" mentioned in the excerpt below
    can be modified/customized?
    Thanks....
    format 'format_string'
    specifies the filename to use for the backup piece. Any name that is legal as a sequential filename on the platform is allowed, provided that each backup piece has a unique name. If backing up to disk, then any legal disk filename is allowed, provided it is unique. If you do not specify the format parameter, RMAN stores the backup pieces in a port-specific directory ($ORACLE_HOME/dbs on UNIX).

    i have used a different directory other then port-specific one and i am able to backup .
    format '/disk2/app/oracle/test/%d_%s_%t' , i have given full path names instead of substitution variables. i am not sure how
    they(variables) will work though in rman.

  • Is it possible to use a variable in the name of other variables?

    Trying to avoid a long post; is there some command in Java that would allow a variable to be read before the rest of the statement it is in?
    For example, using a pair "@" to encapsulate a variable with the mystery command I'm looking for:
    *public class Example {*
    *public static void main (String[] args) {*
    Char variable = "A";
    int @variable@_Status = 0;
    So that this application would create an integer named "A_Status" and assign it a value of 0. Obviously, I'm not looking to be told that "int A_Status = 0" is the best way to do that, I'd like "variable" to be able to be defined by input or change somehow in the code. I have a gut feeling that this is impossible due to the compiler, but I'd like a more professional opinion. Anyone?

    The variable "name" is a lot less important than you think. In fact, when your code is compiled, the computer doesn't care one jot about the name of the variable.
    You should not worry about trying to do this, but rather should tell us the reason why you would even want this. If we knew that, we could show you a better way, guaranteed.

  • I'm using TestStand/Labview to do a string value test. Is there any way to use a variable in the edit string value test?? This forces you to hard code a string to test against.

    I'm using TestStand 2.0/Labview 6i to do a string value test. Is there any way to use a string variable in the edit string value test instead of an actual string?? This forces you to hard code a string to test against.

    Hi ART,
    You can also use the LimitLoader step to load your string into to step similar to the Numeric Step type.
    There should be an example of this in the Resource Library | TestStand
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • How  can use a variable in the folowing code?

    How  can use a variable 'W_ROWNUM2' in the folowing code?
    MOVE '1' TO CNT.
    LOOP AT L_T_PM2.
                  CONCATENATE '0' CNT INTO W_ROWNUM2.CONDENSE W_ROWNUM2.
                   CONCATENATE 'F110V-VARI'W_ROWNUM2'(01)' INTO FLD2.
        perform  DYNPRO_FIELD       using FLD2
                                     L_T_PM2-vari12_con.
                   CNT = CNT + 1.
                   CONDENSE CNT.                                                              
    ENDLOOP.
    I need to increment the value of W_ROWNUM2.
    Please ,it is urgent!!

    Hello
    CONCATENATE 'F110V-VARI'W_ROWNUM2'(01)' INTO FLD2.
    Try using spaces between parts of the resulting string.
    CONCATENATE 'F110V-VARI'  W_ROWNUM2  '(01)'   INTO FLD2
    Regards
    Greg Kern.

  • Using Session Variable in the Column Level Security

    My Question -
    1. I created an initialization block with initialization string by calling a new session variable CTP_ID_LIST in the sql command, given appropriate database connections and when I exit out of Block, and chosen Row-wise initialization. I do not see a new session variable created under variables list. Why does this happen? Please help me on this.

    Hi,
    This happens when you select Row-wise Initialization.
    The row-wise initialization feature allows you to create session variables dynamically and set their values when a session begins. The names and values of the session variables reside in an external database that you access through a connection pool. The variables receive their values from the initialization string that you type in the Initialization Block dialog box.
    You can also use the row-wise initialization feature to initialize a variable with a list of values. You can then use the SQL IN operator to test for values in a specified list.
    Example: Using the table values in the previous example, you would type the following SQL statement for the initialization string:
    select 'LIST_OF_USERS', USERID
    from RW_SESSION_VARS
    where NAME='STATUS' and VALUE='FULL-TIME'
    This SQL statement populates the variable LIST_OF_USERS with a list, separated by colons, of the values JOHN and JANE; for example, JOHN:JANE. You can then use this variable in a filter, as shown in the following WHERE clause:
    where TABLE.USER_NAME = valueof(NQ_SESSION.LIST_OF_USERS)
    The variable LIST_OF_USERS contains a list of values, that is, one or more values. This logical WHERE clause expands into a physical IN clause, as shown in the following statement:
    where TABLE.USER_NAME in ('JOHN', 'JANE')
    Regards
    MuRam

Maybe you are looking for

  • ALE message VG203

    Hi to all, My scenario is the automatic creation of Sales order to my SAP system by tranlating a PO from another SAP system through ALE. I have used message type ORDERS and I have the following problem. The Idoc passed correctly to the receiver syste

  • Website doesn't display correctly, some areas cut off

    All pages of my website cut off some text at the top and bottom. This does not happen with any other web pages I browse! The site was created by our developer and based on a Themeforest theme (from Envato) called Franklin Crowdfunding. Interestingly,

  • Cannot print PDFs in Adobe Reader 11

    When I try to print a PDF using Adobe Reader 11, it says that it cannot print because no pages have been selected for print. Here's some more information: What I have done: printed a PDF through a web browser. This worked fine. saved that same PDF, r

  • GTX transceiver wizard set CPLLREFCLK="101" in property/xci generate and stay for dcp ooc?

    VC707 - transceivers wizard 3.5 ... How do I with GTX transceiver wizard set CPLLREFCLK="101" so I can select my gt0_gtsouthrefclk0_in (which I'm in QUAD 113 so this is from QUAD114 correct)? I currently have to open ..._multi_gt.vhd and the _funcsim

  • What's the best way to erase and reinstall Lion?

    I'm a little confused by the various posts I've read about erasing and reinstaling lion.  My MBP is about 4 years old.  I upgraded to lion last summer and it never worked great, but over the last 3-6 months its been dragging.  I want to start fresh.