check GLOBAL.MPT for a report before copying a new one 
Author Message
 check GLOBAL.MPT for a report before copying a new one

Hi all-
I'm trying to copy a custom report from a .mpp file to a local
global.mpt file using VBA(project2k). There is a chance that the
user may already have a custom report of the same name. I don't
want to overwrite the existing report, I'd rather rename the
existing one and then copy mine into the file
.
I can check a project's ReportList to see if a report is already
there, but I'm having trouble checking the ReportList of the
Global.mpt file. My code:

For intIndex = 1 To Projects("global.mpt").ReportList.Count

It generates an 'Object Required' error, I suppose because the
global file is hidden, or windowless or whatever. It works fine
if I refer to an ordinary project file that's open.

I can use a workaround by trying to rename the report in the
global file in conjunction with an error handler. However, I
just feel like there's gotta be a way to create a reference to
the gloabl.mpt file so I can check it's ReportList. It's one of
those things like, "I know it's here, I'm just missing it!"
Anyone got any info? Anyone? Anyone?
TIA
Tim
--
Remove 'nospam.' when replying
"Sometimes magic sounds like tape." - The Amazing Jonathan
KCPkK lwWmO ECs+++ m4 CPE B-18 Ow Lem ScnC T+++ A4 H6 b5



Sun, 07 Mar 2004 05:25:15 GMT  
 check GLOBAL.MPT for a report before copying a new one
Try this:
You are getting the error likely because you are looking in
"Global.mpt" which is not "really" open. The macro below will find
reports if they are in the Global or if they are in the activeproject.

Sub Reportslisting()
Dim rpt As Variant
Dim searchname As String

searchname = "Report Name"
For Each rpt In ActiveProject.ReportList
    If rpt = searchname Then
        Debug.Print "Found: " & searchname
        Exit Sub
    End If

Next r
End Sub
--
Brian K
MS Project MVP



Sun, 07 Mar 2004 06:58:53 GMT  
 check GLOBAL.MPT for a report before copying a new one


Quote:
> Try this:
> You are getting the error likely because you are looking in
> "Global.mpt" which is not "really" open. The macro below will find
> reports if they are in the Global or if they are in the activeproject.

> Sub Reportslisting()
> Dim rpt As Variant
> Dim searchname As String

> searchname = "Report Name"
> For Each rpt In ActiveProject.ReportList
>     If rpt = searchname Then
>         Debug.Print "Found: " & searchname
>         Exit Sub
>     End If

> Next r
> End Sub

Thanks, but that's not exactly what I was looking for. I already
know it's in the ActiveProject beacuse I'm trying to copy if
from there. What I'm trying to determine is if it's in the
Global file only, not in the ActiveProject.
Thanks anyway,
Tim
--
Remove 'nospam.' when replying
"Sometimes magic sounds like tape." - The Amazing Jonathan
KCPkK lwWmO ECs+++ m4 CPE B-18 Ow Lem ScnC T+++ A4 H6 b5


Sun, 07 Mar 2004 20:52:20 GMT  
 check GLOBAL.MPT for a report before copying a new one
You may need to just do your organizer move and then trap the error that
comes up if it is already there. I seem to recall having to do a similar
thing with Views.
--
Brian K
MS Project MVP


Mon, 08 Mar 2004 00:06:41 GMT  
 check GLOBAL.MPT for a report before copying a new one


Quote:
> You may need to just do your organizer move and then trap the error that
> comes up if it is already there. I seem to recall having to do a similar
> thing with Views.

Yep, that's what I'm doing already. Thanks for the info. It
makes me feel better to know I'm not missing something.
Thanks again,
Tim
--
Remove 'nospam.' when replying
"Sometimes magic sounds like tape." - The Amazing Jonathan
KCPkK lwWmO ECs+++ m4 CPE B-18 Ow Lem ScnC T+++ A4 H6 b5


Mon, 08 Mar 2004 00:19:53 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. VBA: Copy Import map from custom template to Global.mpt

2. How to copy ThisProject module to global.mpt?

3. Error while copying a module to the Global.Mpt

4. Low performance: Copying toolbar to GLOBAL.MPT

5. How can I copy a toolbar to GLOBAL.MPT

6. Global.MPT and Enterprise Global Template

7. Global.mpt has disappeared from Project Explorer

8. Install macros to the local (C drive) Global.mpt file (MSP 2002 prof)

9. Macros in Global.MPT

10. referencing in global.mpt

11. Launch a specific global.mpt

12. Need Help Understanding Global.mpt

 

 
Powered by phpBB® Forum Software