Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Apr 2005
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using Variables across MSP, Excel in VBA (MSP 2003)

    Hi,
    I am writing a program in which first a user inputs a week starting date and based on some calculations the no. of weeks in the month are calculated (either 4 or 5) . I have declared public varialbe as wk1 (for week starting date) and wdth (for no. of weeks - 4 or 5) respectively.
    After this I have declared the object variable like this: Dim appProj As MSProject.Application
    and then Set appProj = New MSProject.Application
    There are several MSP functions that I am performing after this like:
    appProj.ViewApply Name:="Tas&k Usage"
    appProj.OutlineShowSubTasks
    appProj.ToggleAssignments
    Till this point it is working fine.
    Now after this when I am using the following for selecting the time phased data (Using the variables above)
    appProj.SelectTimescaleRange Row:=0, StartTime:=wk1, width:=wdth, Height:=5000
    It is giving error Run Time Error - The argument value is not valid.
    Can you help me pls.
    Thanks

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Using Variables across MSP, Excel in VBA (MSP 2003)

    What are the types and values of wk1 and wdth? Do these coincide with the data values that are acceptable arguments for SelectTimescaleRange?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    Lounger
    Join Date
    Apr 2005
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using Variables across MSP, Excel in VBA (MSP 2003)

    Hi,

    I delcared - Public wk1 As Date and Public wdth As Integer
    The value I am getting for wk1 (in one such case) is 6/2/2006 and wdth as 5

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Using Variables across MSP, Excel in VBA (MSP

    In Microsoft's help example (online here), the last parameter is 1. Could 5000 be too high?

  5. #5
    Lounger
    Join Date
    Apr 2005
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using Variables across MSP, Excel in VBA (MSP 2003)

    Hi

    I got the solution. The first error was that wk1 needs to be declared as variant and second one that Row no. cannot start with 0.

    Thanks for your interest in solving this.

Posting Permissions

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