Re: Getting Column Titles
From: das (das_at_discussions.microsoft.com)
Date: 12/03/04
- Next message: Leviathant: "Re: Creating monthly Actuals reports for all active projects."
- Previous message: John: "Re: How to synch up VBA Modules"
- In reply to: John: "Re: Getting Column Titles"
- Next in thread: John: "Re: Getting Column Titles"
- Reply: John: "Re: Getting Column Titles"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 3 Dec 2004 05:27:13 -0800
I was trying the following code but to no avail;
Dim pjCustomTaskText1 As String
Dim Task_Name As Long
pjCustomTaskText1 = "pjCustomTaskText" & (i)
Task_Name = pjCustomTaskText1
xlRng = CustomFieldGetName(Task_Name)
I was hoping to use the Task_Name aas long and throw in the pjfield name.
Will this approach work at all?
Jeff
"John" wrote:
> In article <ZWPrd.157356$SM5.8852@news.easynews.com>,
> "Buster" <bubs@gmail.com> wrote:
>
> > I have tried the code you supplied, but have one question, why does it fail
> > when I substitute "pjCustomTaskText1" with "pjCustomTaskText&i)" where i is
> > the variable from the for next counter so that I loop through each of the 1
> > to 40 fields.
>
> Jeff,
> It fails because the argument in the CustomFieldGetName Method is a long
> and you are trying to use a string. There are various ways to handle
> this.
>
> One method that sometimes works is use the long numerical value. For
> example, use 188743731 instead of pjCustomTaskText1. This method works
> best if the numerical values for each of the fields of interest are
> sequential (or nearly so). Then increment the value to the next field.
> Note that the difference isn't always "1" and there may be breaks in the
> sequence so those will have to be addressed. Another downside is that by
> using the numerical value, it is not obvious which field is being
> addressed.
>
> Another method that works is to set up a case statement to change the
> long constant each run through the loop. Yes it is a lot of case
> statements but it gets the job done.
>
> Hope this helps.
> John
>
- Next message: Leviathant: "Re: Creating monthly Actuals reports for all active projects."
- Previous message: John: "Re: How to synch up VBA Modules"
- In reply to: John: "Re: Getting Column Titles"
- Next in thread: John: "Re: Getting Column Titles"
- Reply: John: "Re: Getting Column Titles"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|