JBBennett
Technical User
- Jul 31, 2012
- 6
I am getting an "Invalid use of New keyword." error in my code. I am working on a Word 2010 VBA document. The code is:
Dim Rate As clsHourlyRates
Set Rate = New clsHourlyRates
For intCounter = 1 to 2
Selection.GoTo What:=wdGoToBookmark, Name:="Hourly_Rate_" & intCounter
Selection.TypeText Text:=CallByName(Rate, strClientCode & "_Rate", VbGet)
Next
The class in question is not part of my project. It is part of a different project to which I have set a referrence. I am pretty new to class modules so as I was typing this it occured to me that maybe I cannot instantiate a class unless that class is part of my project. I will try that.
Also, I am new to this site and looked for a document on proper posting ettiquet but could not find one. If there is one, or if anyone has any suggestions, please let me know.
Thank you.
Jason Bennett
Dim Rate As clsHourlyRates
Set Rate = New clsHourlyRates
For intCounter = 1 to 2
Selection.GoTo What:=wdGoToBookmark, Name:="Hourly_Rate_" & intCounter
Selection.TypeText Text:=CallByName(Rate, strClientCode & "_Rate", VbGet)
Next
The class in question is not part of my project. It is part of a different project to which I have set a referrence. I am pretty new to class modules so as I was typing this it occured to me that maybe I cannot instantiate a class unless that class is part of my project. I will try that.
Also, I am new to this site and looked for a document on proper posting ettiquet but could not find one. If there is one, or if anyone has any suggestions, please let me know.
Thank you.
Jason Bennett