-
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.
-
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.
-
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.
-
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.
-
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
-
Forum Rules