Consulting

Results 1 to 5 of 5

Thread: Distributing MSP Macro

  1. #1
    VBAX Regular
    Joined
    Sep 2004
    Posts
    10
    Location

    Question Distributing MSP Macro

    oI have a one-off macro that needs to be run by a number of users to rename a number of resources on their resource sheet in Microsoft Project.

    Any ideas how I could distribute this to my users for them to run? I wouldn't want them doing a copy/paste into VBE or importing a VBA module into their project file.

    Thanks, Sean.

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    You can make the code in VB Script so they just run the file like an exe.

    Just put the code into a text document and save it with a .vbs extension.

  3. #3
    VBAX Regular
    Joined
    Sep 2004
    Posts
    10
    Location
    How do I actually get this to run DRJ?? Below is the code in my project vba module - are you saying just copy this into a text file and save it with a .vbs extension??

    [VBA] Sub ReplaceName()
    ViewApply Name:="Resource Sheet"
    Replace Field:="Name", Test:="contains", Value:="project manager", _
    Replacement:="project manager IT", ReplaceAll:=True, Next:=True, _
    MatchCase:=False
    End Sub[/VBA]

    Sorry for being a bit dumb, but I haven't done any VB scripting before, just plain old VB for Excel.

    Thank, Sean.

  4. #4
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Well the code can be put into a text file then SaveAs, select All Files as the type and save with the .vbs extension. But the code will need to be modified. You need to specify what file to open etc.

  5. #5
    VBAX Regular
    Joined
    Sep 2004
    Posts
    10
    Location
    Cheers DRJ - Nearly done what I need to do. The below works in terms of opening up the MSP file, but when I add in the ViewApply statment I get an error saying 'Expected statement'.

    The statement works when run in MS Project itself.

    Any ideas. Sean.

    [VBA] Dim objMSP
    Set objMSP = WScript.CreateObject("MSProject.Application")
    objMSP.Visible = TRUE
    objMSP.FileOpen "C:\Documents and Settings\Desktop\Project1.mpp"
    objMSP.ViewApply Name:="Resource Sheet"
    objMSP.Replace Field:="Name", Test:="contains", Value:="project manager", _
    Replacement:="project manager IT", ReplaceAll:=True, Next:=True, _
    MatchCase:=False

    [/VBA]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •