VBA Compile Error: User-Defined Type Not Defined-Please Help : )

VBA Compile Error: User-Defined Type Not Defined-Please Help : )

Post by andy.nova » Fri, 07 Nov 2008 00:42:58


n Nov 5, 2:05m, "Rod Gill" <rodATproject-systemsDOTcoDOTnz> wrote:
>> >> >> >> >> >> >> > > onn.ConnectionString = "Provider=sqloledb;> >
> > "Data Source=##>#>;" _
> > "Initial Catalog=ProjectServer_Re>o>ting;" _
> > "Integrated >e>urity=SSPI;"
>
> > 'Open Recordset with a>l>Performers in
> > s.Open "Select CAST(MemberFullValue as>v>rchar(255)) AS
> > MemberValue,MemberDescription FROM MSPLT_Perform>r>UserView WHERE &g<;> > (MemberValue <> '') ORDER BY M>mb>r>alue", Conn
>
> > Dim rs2 A> >DODB.Recordset
> > 'Create Connection>t> the .mdb file
> > et rs2 = N>w >D>DB.Recordset
>
> > 'Open Recordset with al> >ervice Areas in
> > s2.Open "Select MemberValue FROM [MSPLT_Ser>i>e Area_UserView]
> >&g<;WHERE (MemberValue <> '') ORDER BY>Me>b>rValue", Conn
>
> > Dim rs3>A> ADODB.Recordset
> > 'Create Connecti>n>to the .mdb file
> > et rs3 =>Ne> >DODB.Recordset
>
> > 'Open Recordset with>a>l Institutions in
> > s3.Open "Select MemberValue FROM [MSPLT_>n>titution_UserView]
>&g<;> WHERE (MemberValue <> '') ORDER >Y >e>berValue", Conn
>
> > Dim r>4>As ADODB.Recordset
> > 'Create Connec>i>n to the .mdb file
> > et rs4>= >e> ADODB.Recordset
>
> > 'Open Recordset wi>h>all Institutions in
> > s4.Open "Select MemberVa>u> FROM [MSPLT_Project
> > Classification_UserV>ew] <HERE (Memb>r>alue <> '') ORDER BY >> > >emberValue", Conn
>
> > >I>itialize Combo Boxes >>>> im i As Int>g>r
> > gt;s>MoveFirst
> > = 0
> > >t> NewProject.>e>mComboBox> > > AddItem
> >>gt;List(i, 0) = rs!MemberDescripti>n> > > .List(i, 1) = rs!Me>b>rFullValue
> > > > List(i, 1) = >s>MemberValue
> > gt;gt; = i + 1
>>> > > s.MoveNext
> > gt;n> With
>
> > o Until rs2.EOF
> > Debug.Print >s>!MemberValue
> > gt;gt;ewPro>ec>.>vcAreaComboBox.AddIte> >rs2!MemberValue)
> > s2.M>v>Next
> > oop
>
> > o Until rs3.EOF
> > Debu>.>rint rs3!MemberValu> >> > gt;>w>roject.InstitutionCom>o>ox.AddItem (rs3!MemberValue)
> > > > s3.MoveNext
> > oop
>
> > o Until rs4.EOF
> > > Debug.Print >s>!MemberVa>ue> > > s4.MoveNex> >> > oop
>
> > 'Dis>l>y user form
> > NewProject.Sho>
> > Fi>e>ew Template:=""
> > ViewAppl> Name:="_P>l>t Vie<"
>
> > 'Get Enterprise R>so>r>es for the selected team
> > f NewPr>j>ct.TeamComboBox <> "" Then
> > >Di> >s5 As ADODB.Recordset
>
> > Create Connectio> t> >he .mdb file
> > et rs5 = New ADODB.Reco>d>et
>
> > Open Recordset with all enterprise r>s>urces in
>
> > s5.Open "Select Reso>rc>C>ientUniqueID FROM
> > [M>P>EpmResource_UserView]" & " WHERE RBS LIKE '%" &
>>>>NewProject.TeamComboBox.Column(1) & "%'", Conn
>
> > > > o Until rs5.EOF
> >>gt;gt; D>b>g.Print rs4!Resour>e>lientUnique>D >>>> nterpriseResourceGet (rs5!ResourceClientUniqueI>)> > > s5.MoveNext
> > oop
>
>>>>s5.Close
> > nd If
>
> > etTaskField Fiel>:>"Name", Value:="Requirements", TaskID:=1
> > etTaskFiel> >ield:="Name", Value:="Design", TaskID:=2
> > etTaskField F>el>:>"Name", Value:="Development", TaskID:=
 
 
 

VBA Compile Error: User-Defined Type Not Defined-Please Help : )

Post by andy.nova » Fri, 07 Nov 2008 05:01:43

n Nov 5, 2:05m, "Rod Gill" <rodATproject-systemsDOTcoDOTnz> wrote:
>> >> >> >> >> >> >> > > onn.ConnectionString = "Provider=sqloledb;> >
> > "Data Source=##>#>;" _
> > "Initial Catalog=ProjectServer_Re>o>ting;" _
> > "Integrated >e>urity=SSPI;"
>
> > 'Open Recordset with a>l>Performers in
> > s.Open "Select CAST(MemberFullValue as>v>rchar(255)) AS
> > MemberValue,MemberDescription FROM MSPLT_Perform>r>UserView WHERE &g<;> > (MemberValue <> '') ORDER BY M>mb>r>alue", Conn
>
> > Dim rs2 A> >DODB.Recordset
> > 'Create Connection>t> the .mdb file
> > et rs2 = N>w >D>DB.Recordset
>
> > 'Open Recordset with al> >ervice Areas in
> > s2.Open "Select MemberValue FROM [MSPLT_Ser>i>e Area_UserView]
> >&g<;WHERE (MemberValue <> '') ORDER BY>Me>b>rValue", Conn
>
> > Dim rs3>A> ADODB.Recordset
> > 'Create Connecti>n>to the .mdb file
> > et rs3 =>Ne> >DODB.Recordset
>
> > 'Open Recordset with>a>l Institutions in
> > s3.Open "Select MemberValue FROM [MSPLT_>n>titution_UserView]
>&g<;> WHERE (MemberValue <> '') ORDER >Y >e>berValue", Conn
>
> > Dim r>4>As ADODB.Recordset
> > 'Create Connec>i>n to the .mdb file
> > et rs4>= >e> ADODB.Recordset
>
> > 'Open Recordset wi>h>all Institutions in
> > s4.Open "Select MemberVa>u> FROM [MSPLT_Project
> > Classification_UserV>ew] <HERE (Memb>r>alue <> '') ORDER BY >> > >emberValue", Conn
>
> > >I>itialize Combo Boxes >>>> im i As Int>g>r
> > gt;s>MoveFirst
> > = 0
> > >t> NewProject.>e>mComboBox> > > AddItem
> >>gt;List(i, 0) = rs!MemberDescripti>n> > > .List(i, 1) = rs!Me>b>rFullValue
> > > > List(i, 1) = >s>MemberValue
> > gt;gt; = i + 1
>>> > > s.MoveNext
> > gt;n> With
>
> > o Until rs2.EOF
> > Debug.Print >s>!MemberValue
> > gt;gt;ewPro>ec>.>vcAreaComboBox.AddIte> >rs2!MemberValue)
> > s2.M>v>Next
> > oop
>
> > o Until rs3.EOF
> > Debu>.>rint rs3!MemberValu> >> > gt;>w>roject.InstitutionCom>o>ox.AddItem (rs3!MemberValue)
> > > > s3.MoveNext
> > oop
>
> > o Until rs4.EOF
> > > Debug.Print >s>!MemberVa>ue> > > s4.MoveNex> >> > oop
>
> > 'Dis>l>y user form
> > NewProject.Sho>
> > Fi>e>ew Template:=""
> > ViewAppl> Name:="_P>l>t Vie<"
>
> > 'Get Enterprise R>so>r>es for the selected team
> > f NewPr>j>ct.TeamComboBox <> "" Then
> > >Di> >s5 As ADODB.Recordset
>
> > Create Connectio> t> >he .mdb file
> > et rs5 = New ADODB.Reco>d>et
>
> > Open Recordset with all enterprise r>s>urces in
>
> > s5.Open "Select Reso>rc>C>ientUniqueID FROM
> > [M>P>EpmResource_UserView]" & " WHERE RBS LIKE '%" &
>>>>NewProject.TeamComboBox.Column(1) & "%'", Conn
>
> > > > o Until rs5.EOF
> >>gt;gt; D>b>g.Print rs4!Resour>e>lientUnique>D >>>> nterpriseResourceGet (rs5!ResourceClientUniqueI>)> > > s5.MoveNext
> > oop
>
>>>>s5.Close
> > nd If
>
> > etTaskField Fiel>:>"Name", Value:="Requirements", TaskID:=1
> > etTaskFiel> >ield:="Name", Value:="Design", TaskID:=2
> > etTaskField F>el>:>"Name", Value:="Development", TaskID:=
 
 
 

VBA Compile Error: User-Defined Type Not Defined-Please Help : )

Post by Rod Gil » Fri, 07 Nov 2008 15:38:06

es, sorry. You need a reference to the latest MDAC (should be 2.8) in your
PC. Sometimes when copying modules to the Global.mpt I find the reference
doesn't get copied!

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com



" XXXX@XXXXX.COM " < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
On Nov 5, 2:05 am, "Rod Gill" <rodATproject-systemsDOTcoDOTnz> wrote:

Rod, it appears that an oledb driver is already being referenced
(Provider=sqloledb).
Should the Provider reference a different string?

Sorry, I'm very very new at this and will need a bit more information
to "get it".

Thanks,
Andy

Sub SDLC()
'You need a reference to Microsoft ActiveX Data Objects 2.5
'or greater to let this code run
Dim Conn As New ADODB.Connection
Dim rs As ADODB.Recordset
'Create Connection to the .mdb file
Set Conn = New ADODB.Connection
Set rs = New ADODB.Recordset
Conn.ConnectionString = "Provider=sqloledb;" _
& "Data Source=#####;" _
& "Initial Catalog=ProjectServer_Reporting;" _
& "Integrated Security=SSPI;"
Conn.Open

 
 
 

VBA Compile Error: User-Defined Type Not Defined-Please Help : )

Post by andy.nova » Fri, 07 Nov 2008 23:36:12

n Nov 6, 12:38m, "Rod Gill" <rodATproject-systemsDOTcoDOTnz> wrote:
> Set rs = New ADODB.Records>t
> Conn.ConnectionString = "Provider=sqloledb>" _
> & "Data Source=#>###;" _
> & "Initial Catalog=ProjectServer_R>porting;" _
> & "Integrated>Security=SSPI;"
> Conn.Open

Rod, I'm sorry but I don't know where to start on that. Could you
please be specific as to how I would accomplish this task?

Thanks,
Andy
 
 
 

VBA Compile Error: User-Defined Type Not Defined-Please Help : )

Post by andy.nova » Fri, 07 Nov 2008 23:38:24

n Nov 6, 12:38m, "Rod Gill" <rodATproject-systemsDOTcoDOTnz> wrote:
> Set rs = New ADODB.Records>t
> Conn.ConnectionString = "Provider=sqloledb>" _
> & "Data Source=#>###;" _
> & "Initial Catalog=ProjectServer_R>porting;" _
> & "Integrated>Security=SSPI;"
> Conn.Open

By PC, are you talking about my physical workstation? I'm wanting
this to be a global macro that everyone can run.
Sorry, I'm going to need a little guidance on this. Is this
referenced in your book somewhere?
 
 
 

VBA Compile Error: User-Defined Type Not Defined-Please Help : )

Post by Rod Gil » Sat, 08 Nov 2008 14:18:29

n your PC, open the Global file then open the macro from the global file in
the VBEW. Now set the relevant reference in the VBE. Compile, save and close
the global file.

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com



" XXXX@XXXXX.COM " < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
On Nov 6, 12:38 am, "Rod Gill" <rodATproject-systemsDOTcoDOTnz> wrote:

By PC, are you talking about my physical workstation? I'm wanting
this to be a global macro that everyone can run.
Sorry, I'm going to need a little guidance on this. Is this
referenced in your book somewhere?

 
 
 

VBA Compile Error: User-Defined Type Not Defined-Please Help : )

Post by andy.nova » Sun, 09 Nov 2008 00:05:22

n Nov 6, 11:18m, "Rod Gill" <rodATproject-systemsDOTcoDOTnz> wrote:
> referenced in your book somewhere?

Rod, I finally found how to set the reference (under Tools in the VB
Editor). Here's the deal...

It worked from within EGLOBAL -- for me only.

When I had an end user invoke the macro, they received a run-time
error ' -2147217843 (80040e4d) Login failed AD\xxxxxxx"

What I'm guessing is that you have to have Administrator priviledges
to run this code, correct?

Here's my followup ?

How do I embed a login string in the code and somehow either encrypt
the password or create an executable of the VBA or remove access to
the source so that when the end user happens to see the code, they
won't see the password? And, I don't want to give Administrator
priviledges to all PMs.

Thanks in advance for the tip!! :)

Andy Novak
UNT