M
Michael A.
Hello All,
To start with, the following code works in VBA without issue:
Set Tsvs = resAsgnmt.TimeScaleData(prStart, prEnd,
pjAssignmentTimescaledWork, pjTimescaleMonths)
'Obtain the timescale data for each resource
j = 2
For Each Tsv In Tsvs
allResources(i, j) = allResources(i, j) + Val(Tsv.Value)
resourcesTotalWork(i, j) = resourcesTotalWork(i, j) + Val(Tsv.Value)
j = j + 1
Next Tsv
I convert this into Visual Studio as - it is just about identical:
tsvs = resAsgnmt.TimeScaleData(prStart, prEnd,
MSProject.PjAssignmentTimescaledData.pjAssignmentTimescaledWork,
MSProject.PjTimescaleUnit.pjTimescaleMonths)
j = 2
Dim tsv As MSProject.TimeScaleValue
For Each tsv In tsvs
resourceWorkAlloc(i, j) = resourceWorkAlloc(i, j) + Var(tsv.Value)
resourcesTotalWork(i, j) = resourcesTotalWork(i, j) + Var(tsv.Value)
Next tsv
The problem:
When the code cycles through the 'tsv' values, it works for some instances
but then all of a sudden throws an unhandled unexpected error as follows:
System.Runtime.InteropServices.COMException was unhandled by user code
ErrorCode=-2146827284
HelpLink="D:\Program Files\Microsoft Office\Office12\VBAPJ.CHM#131072"
Message="An unexpected error occurred with the method."
Source=""
I see here that for some reason it doesn't like the empty string and yet it
the code has successfully processed empty strings earlier.
Would anyone have any thoughts as to why this would occur and what I may do
to resolve?
I appreciate your time and consideration.
Kind regards
Michael A.
To start with, the following code works in VBA without issue:
Set Tsvs = resAsgnmt.TimeScaleData(prStart, prEnd,
pjAssignmentTimescaledWork, pjTimescaleMonths)
'Obtain the timescale data for each resource
j = 2
For Each Tsv In Tsvs
allResources(i, j) = allResources(i, j) + Val(Tsv.Value)
resourcesTotalWork(i, j) = resourcesTotalWork(i, j) + Val(Tsv.Value)
j = j + 1
Next Tsv
I convert this into Visual Studio as - it is just about identical:
tsvs = resAsgnmt.TimeScaleData(prStart, prEnd,
MSProject.PjAssignmentTimescaledData.pjAssignmentTimescaledWork,
MSProject.PjTimescaleUnit.pjTimescaleMonths)
j = 2
Dim tsv As MSProject.TimeScaleValue
For Each tsv In tsvs
resourceWorkAlloc(i, j) = resourceWorkAlloc(i, j) + Var(tsv.Value)
resourcesTotalWork(i, j) = resourcesTotalWork(i, j) + Var(tsv.Value)
Next tsv
The problem:
When the code cycles through the 'tsv' values, it works for some instances
but then all of a sudden throws an unhandled unexpected error as follows:
System.Runtime.InteropServices.COMException was unhandled by user code
ErrorCode=-2146827284
HelpLink="D:\Program Files\Microsoft Office\Office12\VBAPJ.CHM#131072"
Message="An unexpected error occurred with the method."
Source=""
I see here that for some reason it doesn't like the empty string and yet it
the code has successfully processed empty strings earlier.
Would anyone have any thoughts as to why this would occur and what I may do
to resolve?
I appreciate your time and consideration.
Kind regards
Michael A.