Results 1 to 8 of 8
  1. #1
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Compile Error: (A2k Sr1)

    I am trying to start an instance of MS Project from MS access using the below function. However, when I execute the function I receive a Compile Error indicating that the User Defined Type is Not Defined. Why???

    Ultimately, I want to be able to open a selected MS Project file and then save it to the local C drive under a new name.


    Function fncProjectOLE()

    Dim prjapp As msproject.Application
    Dim prjProject As msproject.Project

    Set prjapp = CreateObject("MSproject.application")
    prjapp.Fileopen "C:junk1feb 02NGAV Schedule Statused2_21_02.mpp", ReadOnly:=True
    prjapp.Visible = True


    End Function
    Regards,

    Gary
    (It's been a while!)

  2. #2
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    Faifax, Virginia, USA
    Posts
    542
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Compile Error: (A2k Sr1)

    My guess here is that you need to Register the Project interface with Access. in the VBE, Tools | References and check the Microsoft Project x.0 Object Library

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Compile Error: (A2k Sr1)

    Try dimming prjProject As Object or follow Peter's suggestion and set a reference to the Project object library. You can only use early binding (Dim prjProject As MSProject.Project) if you have a reference set to the object library first.
    Charlotte

  4. #4
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Compile Error: (A2k Sr1)

    Thanks for the information. I did not have MS Project registered with Access. I will let you know if it still does not work.
    Regards,

    Gary
    (It's been a while!)

  5. #5
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Compile Error: (A2k Sr1)

    Thanks Charlotte.

    I don't know how you can remember all of this stuff....
    Regards,

    Gary
    (It's been a while!)

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Compile Error: (A2k Sr1)

    Practice. Years and years and *years* of practice! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Charlotte

  7. #7
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Compile Error: (A2k Sr1)

    Registering MS Project corrected the first problem. Do you know the correct format to save a MS Project Project as an Access Database. This is what I tried (Below), however, it does not work.

    prjapp.FileSaveAs Name, , , , , , , , , MSProject.mdb8

    Thanks
    Regards,

    Gary
    (It's been a while!)

  8. #8
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    Faifax, Virginia, USA
    Posts
    542
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Compile Error: (A2k Sr1)

    >> prjapp.FileSaveAs Name, , , , , , , , , MSProject.mdb8

    I am guessing, as i havent done this before: remove the trailing '8' and you may be ok.

    it also might be easier if you used the ":=" notation, to avoid counting/typing all those commas.

Posting Permissions

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