VBA - Setting Custom Fields For Sub-Projects Using a Master File

Hello,
I was wondering if anyone had any experience or could provide some help with a Macro to set the Custom Fields in Sub-Project Files directly from the Macro. I had this macro working in the past with Project 2007, but it has been a couple years and I am struggling
to resolve an error. I am currently running Project 2010 with SP2. I intend to use this Macro in our Server 2010 environment, however at this time, I'm testing locally on my desktop.
Scenario.
I have a Master File with 2 sub-project (Project A, and Project B) inserted. While working in the Master File, I create a custom field title "TEAM Lookup". While in the Master File and without having to individually go and open, edit, save, and
close each sub-project, push the custom field down to the project files.
ERROR: Currently, the Macro will run and I can step through the lines of code until line 12 where I'm asking Project to use the organizer to shift the newly created custom field from the Master File to a sub-project. The line appears to
populate correctly, but instead of continuing through the loop, an error is caught (ID - 1101 - "The File (Master File) was not found")
Any ideas or suggestions would be greatly appreciated. Thanks
Sample Code
1. Sub CopyCustomFieldToSubprojects()
2. Dim MASTER, custfield, contin, AllDone
3. Dim SubProj As Subproject
4. Alerts False
5. MASTER = ActiveProject.Name
6. Application.EnableCancelKey = pjInterrupt
7. custfield = CustomFieldGetName(ActiveCell.FieldID) & ActiveCell.FieldName
8. On Error GoTo errhand
9. contin = MsgBox("This macro will copy the field " & "(" & custfield & ")" & " (the currently selected field) to all subprojects in this consolidated schedule." & vbCrLf & vbCrLf & "Be
patient, it may take more than 70 seconds to run. You will be notified when it's done. Continue?", vbOKCancel)
10.    If contin = vbCancel Then GoTo done
11.    For Each SubProj In ActiveProject.Subprojects
12.    OrganizerMoveItem Type:=pjFields, FileName:=MASTER, ToFileName:=SubProj.SourceProject.Name, Name:=custfield
13.    Next SubProj
14.     AllDone = MsgBox("The " & custfield & " field has been copied to all subprojects.", vbOKOnly)
15. GoTo done
16. errhand:
17. ret = err.Description
18. ret1 = err.Number
19. done:
20. End Sub

SGBlaine,
Project VBA can get rather fussy about some things so you just have to find out what it wants and then adjust your code accordingly. The following will work:
Note the tweaks to the custfield variable and to the MASTER and source project names. Also when working with strings in VBA it is a good idea to eliminate at least one little gotcha, the need for exact capitalization. Therefore I always add the Option Compare
Text statement. In your macro it won't make any difference since you do not directly create a string value, but it's good practice to have the option.
Option Compare Text
Sub CopyCustomFieldToSubprojects()
Dim MASTER, custfield, contin, AllDone
Dim SubProj As Subproject
Alerts False
MASTER = ActiveProject.FullName 'FullName includes the path, now it can find it
Application.EnableCancelKey = pjInterrupt
custfield = CustomFieldGetName(ActiveCell.FieldID) & " (" & ActiveCell.FieldName & ")"
'strings are very fussy, it has to be exact
On Error GoTo errhand
contin = MsgBox("This macro will copy the field " & "(" & custfield & ")" & " (the currently selected field) to all subprojects in this consolidated schedule." & vbCrLf & vbCrLf & "Be
patient, it may take more than 70 seconds to run. You will be notified when it's done. Continue?", vbOKCancel)
If contin = vbCancel Then GoTo done
For Each SubProj In ActiveProject.Subprojects
    OrganizerMoveItem Type:=pjFields, FileName:=MASTER, ToFileName:=SubProj.SourceProject.FullName, Name:=custfield
Next SubProj
AllDone = MsgBox("The " & custfield & " field has been copied to all subprojects.", vbOKOnly)
GoTo done
errhand:
ret = Err.Description
ret1 = Err.Number
done:
End Sub
John

Similar Messages

  • Export Project Tasks to Excel using VBA by Custom Field

    Question referring to the link:
    http://social.technet.microsoft.com/Forums/projectserver/en-US/9c46458c-893f-41ba-bd46-bdb59c533f4a/export-project-tasks-to-excel-using-vba-by-custom-field?forum=project2010custprog
    Help needed. I have inserted my question at this address for Andrew or anybody else to reply. Hope to hear from you.
    Regards,
    Chuck

    Thank you Andrew for getting back to me and I have found somewhere on the net the following macro that would do the job for the version 2007. Here is a copy for those that may need it.
    Option Explicit
    Sub CreateMenus()
    Dim cbrMain As CommandBar
    Dim ctlMain As CommandBarControl
    Dim ctlOLExport1 As CommandBarControl
    Dim ctlOLExport2 As CommandBarControl
    Dim ctlOLExport3 As CommandBarControl
    Set cbrMain = Application.CommandBars.ActiveMenuBar
    Set ctlMain = cbrMain.Controls.Add(Type:=msoControlPopup, Temporary:=True)
    ctlMain.Caption = "Export to Outlook"
    Set ctlOLExport1 = ctlMain.CommandBar.Controls.Add(Type:=msoControlButton)
    With ctlOLExport1
    .Caption = "Selection to Outlook tasks"
    .OnAction = "Macro """ & "Export_Selection_To_OL_Tasks"""
    End With
    Set ctlOLExport2 = ctlMain.CommandBar.Controls.Add(Type:=msoControlButton)
    With ctlOLExport2
    .Caption = "Selection to Outlook appointments"
    .OnAction = "Macro """ & "Export_Selection_To_OL_Appointments"""
    End With
    Set ctlOLExport3 = ctlMain.CommandBar.Controls.Add(Type:=msoControlButton)
    With ctlOLExport3
    .Caption = "Selection to Outlook notes"
    .OnAction = "Macro """ & "Export_Selection_To_OL_Notes"""
    End With
    End Sub
    Cheers!
    Chuck

  • How Update Custom fields for EABL DB table by using BAPI_MTRREADDOC_UPLOAD

    Hi friends,
    How can I Update Custom fields for EABL DB table by using BAPI_MTRREADDOC_UPLOAD
    for the parameter EXTENSIONIN of type BAPIPAREX
    I am passing the Structure as BAPI_TE_EABL
    in that structure MRIDNUMBER as EABL-ABLBELNR field value
    ZMESSAGE some text of 30 char and
    ZSKIPC of 2 char
    but I am not able to update that data for the MRIDNUMBER (ABLBELNR ) in DB table EABL
    I am getting RETURN Structure message type E
    as
    "Upload interim entries: Maintain one table only"
    Can any one provide me solution
    Thanks in Advance
    Ganesh

    Hi,
    Refer the following SAP notes.
    1. Note 485557 - BAPI_REQUISITION_CREATE: 'EXTENSIONIN' customer enhancements
    2. Note 584902 - BAPI_REQUISITION_CHANGE: ExtensionIn not connected
    3. Note 792132 - EBAN, EBKN: user-defined fields are not filled
    Regards,
    Harish

  • Missing Functionality -where do I set a budget for a Project?

    Budgeting for Projects is non - existent
    Budget for Profit and Loss for a particular project , How is it done ?
    Does not work , No facility to put in Budget for a project ?
    The report I am trying to run is:
    REPORTS>FINANCIAL>BUDGET REPORTS>Profit and Loss Statement Budget Report.Then go to Expanded and choose a PROJECT, say MailOrder.
    The result is that it will show the MailOrder project for the ACTUAL but it will show the whole company Turnover against the BUDGET column.
    This is because there is no place to set a budget for MailOrder Project in the first place. So the question is where do I set a budget for a Project?
    1 Budget setup screen - this has no facility to setup a budget for a PROJECT
    2.Budget Profit and Loss - this has the facility to run a PROJECT budget but the figures for the Budget cannot be right because they were not setup in the first place.
    PS MailOrder project is just an example.
    Version: SAP BUSINESS ONE 2007 A Patch Level 41
    Description of requirements: As above
    (Valid as of: (Date that this legal requirement is applicable) N/A
    Business needs: Customer cannot set the budget for a project and this effects their accounting.
    Examples: (Please describe a typical example, how the functionality should work.)
    Current Workaround: None.
    Proposed solution: Create a Project and then be able to set a Budget for it
    Edited by: Darpal Thiarha on May 14, 2008 10:34 AM

    Hi Darpal/Kerstin
    Please ignore my previous replies because I have now worked out why this idea will not work:
    Kerstins' idea is based on setting up new Nominal Codes for every Project and for Every Nominal Code in the Profit and Loss structure. Apart from the fact that this will create a messy Nominal Structure with hundreds of Nominal Codes, the main issue here is the way the Cost Of Goods Sold is structured. The logic of our Nominal Structure for Sales and Cost of Goods is based on Item/Item Groups and the Nature of these Items. In our case we sell Skin Care products under 3 Brands. Say Brand A, B and C
    So Brand A is summarised into one item Group and the ITEM GROUP is coded to Sales Nominal 20000 and the Cost of this group is coded to Nominal 30000. In Kertins suggestion, I would need to raise a Nominal Code 20001 for say Project Mail Order and 30001 for the Cost of Goods for Mail Order but this the Mail Order project is selling ALL our brands (A,B,C) - so you can see the problem here. You cannot use Nominal Codes for two different purposes and make it work. So the problem here is that my BRAND A summary will contain a Nominal with a Project Mail Order, that has SALES of Brand A,B,C. The Net effect will be that we will not be able to summarise anything in SALES and Cost of SALES in a logical way (Neither by Brand or By Project) and the Nominal Structure will be a mess.
    My conclusion is that SAP b1 Sales and Cost of Goods section demands certain logic when building the Nominal Codes, and this is based on the NATURE OF THE STOCK ITEM and trying to superimpose the PROJECT issue into this, will never work. In my view, the PROJECT issue needs to be sorted without involving New Nominal codes and the starting point would be in sorting out the SALES and COST of SALES and the project Budget for this.
    Please let me know if you need further illustration of the problem.

  • How to add a custom field to the "Projects" page "Group by" data menu list

    Hi,
    I'm deploying Project Online and I want to group projects by a custom field on the "Projects" page. Currently I can see options for group by Project Name, Start, Finish, % complete etc. I would like to group by a custom field of programme name
    which is filled in on the Project Details form.
    I can create the enterprise field etc, however I can't work out how to make the new enterprise field appear in this list. Or am I barking up the wrong tree and should be creating separate Project Types for each programme?
    Any help an advise greatly appreciated.
    Regards,
    Conrad

    Hello, add the programme field to the Project Center view then it will be available to group by. Paul
    Paul Mather | Twitter |
    http://pwmather.wordpress.com | CPS

  • Replicating Custom Fields for Products in CRM  from ECC

    Hi All,
    I am having difficulty in replicating SAP standard field values from ECC to custom fields for products in CRM. This is what i did:
    1. I created a new settype(ZMASTER_INFO) with a single attribute(ZIND_STD) and added
        this new settype to MAT_HAWA. (As all our materials fall under this material type).
    2. I am looking to map SAP standard field from ECC to this custom field of mine.
        I wrote the code in CRM BADI 
        'ZPRODUCT_CUSTOMER2->MAP_R3_TO_CRM_MATERIAL' with the following code:
    DATA: ls_ZMASTER_INFO TYPE ZMASTER_INFO_maintain.
    DATA: ls_category_bdoc       TYPE COMT_PROD_CAT_REL_MAINTAIN,
          ls_category            TYPE COMT_PROD_CAT_REL,
          lt_categories          TYPE COMT_PROD_CAT_REL_TAB,
          ls_settype             TYPE COMT_settype_ext,
          ls_cat_settype_rel     TYPE COMT_CAT_FRAG_REL,
          lt_cat_settype_rel     TYPE COMT_CAT_FRAG_REL_TAB,
          lt_cat_settype_rel_all TYPE COMT_CAT_FRAG_REL_TAB.
    LOOP AT lt_cat_settype_rel_all INTO ls_cat_settype_rel.
          CALL FUNCTION 'COM_SETTYPE_READ_SINGLE'
            EXPORTING
              IV_SETTYPE_GUID         = ls_cat_settype_rel-frgtype_guid
            IMPORTING
              ES_SETTYPE              = ls_settype
           EXCEPTIONS
             NOT_FOUND               = 1
             NO_IMPORT_VALUES        = 2
             NO_TEXT_FOUND           = 3 .
          IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
      CASE ls_settype-frgtype_id.
          WHEN 'ZMASTER_INFO'.
          ls_ZMASTER_INFO-relation-owner = 'X'.
          ls_ZMASTER_INFO-relation-logsys = cs_product_bdoc-header-com_product-logsys.
          ls_ZMASTER_INFO-data-ZZ0010 = is_mara-STD_DESCR.
          ls_ZMASTER_INFO-DATA_X-ZZ0010 = 'X'.
          APPEND ls_ZMASTER_INFO TO cs_product_bdoc-data-ZMASTER_INFO.
          APPEND ls_settype-FRGTYPE_GUID TO cs_product_bdoc-data-MNT_SETTYPE.
       ENDCASE.
    ENDLOOP.
    Since in ECC i am not having any custom fields i did not write any code in ECC for TPS34 and TBE24. I just wrote this BADI in CRM and using the field S_MARA-STD_DESCR.
    I am not sure if i need to write the code in ECC. COUld anyone please confirm if i need the code in ECC?
    Also in the CRM BADI, lt_cat_settype_rel_all is EMPTY. Not sure how this gets its value.
    Could anyone please suggest if i am missing anything here? Any help is appreciated.
    Thanks,
    Karuna.

    Hi Karuna,
    One more solution is to change the BDoc data content before it hit the Database.
    this can be done in badi: Data_Exchange_badi (if u dont find this try with following search string: xchange)
    In the above mention badi you will find a method which is used to populated the contend jst after bdoc in CRM is being populated by R/3 data.
    Best Regards,
    Pratik Patel
    <b>Reward with Points!</b>

  • User's custom field for metadata entrance

    It would be wonderful if the user could add a series of metadata custom fields.
    I'm thinking in a situation where you might be photographing for a national museum or an art gallery where you could enter a custom field for the artist's name, date of birth & death, nationality, restoration details (who did what & when?), etc..

    I second that one, too. It would be immensely useful. After all, LR is a database, so adding custom fields shouldn't be too difficult, should it?
    I'd be happy for these to be internal only, not exportable.
    David.

  • Adding customized fields for Travel Expenses

    Hi,
    I would like to add some customized fields for user input during the creation of travel expense form.  Is this possible?  If yes, any advise on the steps to create customized fields for data entry of travel expense form?
    Thanks.

    Hi Yvonne ,
    Thank you for the tip , it was helpfull.
    We are using field BUS_REASON "Business Partners", We changed label for data element but is not showed in TRIP transaction we can see it in PR05 transaction.
    How can I change labels for TRIP transacction?
    We did the change in CMOD transaction
    Thanks.

  • Project Report for One Project Using Excel

    Hi,
    Is is possible to create a report for one project using excel?
    I want to create a pdp with an Excel Viewer web part and have the following tabs with data specific to the one project.
    1. Cover
    2. Issues
    3. Risks
    4. Deliverables
    I tried passing the ProjUid to an Excel doc via the Excel Query Filter Web Part and was able to filter the Issues lists only but don't know if its possible to filter out the other tabs by using the same paramater. Is this possible?
    I have not looked at Odata but was wondering if it was possible to pass a paramater to the odata query and still have the spreadsheet work in a web view in SharePoint?

    Hi,
    I'd say that as far as you promote the Proj UID field as a filter in all sheets of your Excel workbook, using the Excel
    Query Filter Web Part should work fine. But testing it should be easy, since you already did half of the work.
    See excellent article from Andrew on this topic:
    http://azlav.umtblog.com/2012/12/05/filtering-excel-webparts-in-office-365-part-2/
    http://azlav.umtblog.com/2012/07/03/creating-a-project-resource-list-in-a-pdp/
    Hope this helps,
    Guillaume Rouyre, MBA, MCP, MCTS |

  • Enabling Quote custom field for External Pricing Response

    Hi All,
    Using UI configuration (adaptation) we are able to define new fields and enable them for standard web services. The result is that they are included in the relevant WSDLs and can be mapped using PI/HCI to equivalent fields in an external system such as SAP ECC.
    Looking at Quote's for example, we have defined a new field at Product Item Line level and have the following services we can enable it for.
    Enabling for the CustomerQuoteRequestExternalSalesDocumentDataOut outbound service adds the field to the External Pricing request part of the resulting WSDL, however it is not enabled for the response which is key to our requirement.
    Is it possible through PDI to enable this field for the inbound equivalent for CustomerQuoteRequestExternalSalesDocumentDataOut??? If not, is it possible to create the field through PDI and enable it that way?
    Thanks
    Indi

    Hi Chandan,
    Thanks for the response.
    The External Pricing interface for Quotes is synchronous so has no IDoc as such. We send some parameters to fetch a price from SAP ECC, and the response contains all the pricing information.
    In terms of the response, we're able to pass the value we need from SAP ECC to HCI, however there is no place in the WSDL for us to pass it to the field we have defined in C4C.
    The WSDL for External Pricing contains both the request and response structures, therefore two root nodes. Adaptation only allows us to enable the field for the request (outbound) node. I'm trying to work out how we can enable our custom field for the response (inbound) node within the WSDL structure.
    Thanks
    Indi

  • Unable to make master project containing sub-projects using Project Online PWA (Cloud)

    Can anybody help? I tried a lot of navigations in Project Online PWA (not project server) but still unable to make master project containing sub-projects using Project Online PWA (Cloud)

    Hi John,
    It isn't possible to do this in the Project Web App either in Project Online or Project Server - you will need to use Project Professional 2013 and connect to your Project Online instance, or the subscription version, Project Pro for Office 365.
    Best regards,
    Brian Smith
    Blog |
    Facebook | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.
    Project Server TechCenter |
    Project Developer Center |
    Project Server Help | Project Product Page

  • How to populate COPA fields for GL posting using BAPI_ACC_DOCUMENT_POST

    Hi All,
    I am posting documents in FB50 using BAPI_ACC_DOCUMENT_POST. I have a requirement to post the documents with profitability segment parameters as well. Should I use EXTENSION1 table to pass COPA updates and implement BTE to achieve it? Can anyone please guide me with the procedure to populate the COPA fields for GL posting using BAPI_ACC_DOCUMENT_POST?
    Also please let me know how/where to check if COPA is enabled for a GL account.
    Thanks,
    Subathra

    Moderator Message: This forum is for questions directly related to Web Dynpro ABAP only.  It should not be used for general questions.  I am moving this thread to the ABAP General forum.

  • Add a custom field for Product Allocation

    Hi experts,
    I have copied S140 to S501 to add a custom field for product allocation.
    I have added the custom field in MCVBAKUSR, so it is visible in MCVBAK.
    However, I don't know whether I can populate data into custom field. I searched in forum, someone said it can be done in SAP enhancement MCS10001. But it can't work. I have tried to place a break-point in the code, and seems that throughout the order creation and product allocation check, it hasn't get into the codings in enhancement MCS10001.
    Can anyone give me some idea on it? Thanks.

    You should have simply extended VBAK table. It would've taken care of extending MCVBAK, etc. Then VBAK field would have to be populated in a user exit USEREXIT_CHECK_VBAK in MV45AFZB, when a document is being created/changed.

  • When I try to convert my .pdf to Word, I get a sidebar that has fields for: the name of my pdf file, the type of file I want to convert to (In my case, Word), and a button that says "Convert".  My problem is that the "convert to" field isn't active.  I ca

    When I try to convert my .pdf to Word, I get a sidebar that has fields for: the name of my pdf file, the type of file I want to convert to (In my case, Word), and a button that says "Convert".  My problem is that the "convert to" field isn't active.  I can see the words "Microsoft Word" in pale gray, but when I click on the field, nothing happens.

    You have posted in the wrong forum.  Try posting in the forum for the product you are trying to use.
    Here is a link to a page that has links to all Adobe forums... use the drop down list to see all.
    Forum links page:
    https://forums.adobe.com/welcome

  • To test BPEL project using a wsdl file.

    Hello Experts,
    I need to test the BPEL Project using the wsdl file.Is there any tool to test the BPEL project?the tool should generate the input data and expected output result using the wsdl file.
    please reply soon
    Thanks in Advance.

    The entire application means the BPEL Project will be invoking many services.Consider a scenario,that i am creating a bpel project which invokes 10 services.If i make some changes in one service,i must be able to check the bpel project with that service alone.i need not cal all the other services.
    I need a framework or tool thet will generate input data and the expected output based on the wsdl file.
    can u suggest any solution for this?

Maybe you are looking for

  • PL/SQL Portlets accessed through WAP

    Hi, we have developed some PL/SQL portlets (using portal 10g version 9.0.4.0.99) which needs to be accessed in a WAP enabled mobile. need some documents or references for the same. Thanks Ramya

  • ICal Publishing - To Do Lists

    When I publish my iCal calendar, I check the boxs to publish To Dos, Allarms, Auto Update Changes....when I go to the calendar site, not To Dos are published. What is going on?

  • Arch Macbook Pro Sticker

    I designed a vinyl Arch sticker for my Macbook Pro. I've included links to the source file as well. End Product: http://dl.dropbox.com/u/144408/macbook_sticker.jpg Source SVG: http://dl.dropbox.com/u/144408/arch_linux_final.svg What do you think? Las

  • Combining 16:9, 24p and standard NTSC in FCE

    Please forgive the newbie ignorance, but I seem to have gotten myself into a severe predicament with no practical way out. Here's the situation: In a rush of naive enthusiasm, a desire to NOT indulge my usual tendency toward perfectionistic procrasti

  • SimpleChat issue

    Hi everyone, I just got the latest build and the AFCS Navigator, very cool stuff ... congrats to the team working on this. I'm using a SimpleChat instance in my application and I noticed this strange behavior : When you type in text in the text input