![]() |
HELP "ByRef Argument Type Mismatch"
I get the compile error: ByRef Argument Type Mismatch
at the line Call Upate(itercount, a(i)) and it doesn't make sense to me. I am passing only one element of an array and the types seems fine to me. HELP Here is the example: Private type Iteration Name as string count as integer end type private type j domain as string it() as Iteration end type public function start() dim i, itercount as integer dim a(500) as j itercount = Worksheet("iters").Range("c1") for i = 0 to 499 redim a(i).it(itercount ) as Iteration Call Update(itercount, a(i)) next end function ' NOTE this function is in a separate ( .xla sheet) Module Public Function Update(byval icount as long, byref DomIters as j) ' stuff done in here end function |
HELP "ByRef Argument Type Mismatch"
Define itercount as Long not Integer.
-- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "RocketMan" wrote in message oups.com... I get the compile error: ByRef Argument Type Mismatch at the line Call Upate(itercount, a(i)) and it doesn't make sense to me. I am passing only one element of an array and the types seems fine to me. HELP Here is the example: Private type Iteration Name as string count as integer end type private type j domain as string it() as Iteration end type public function start() dim i, itercount as integer dim a(500) as j itercount = Worksheet("iters").Range("c1") for i = 0 to 499 redim a(i).it(itercount ) as Iteration Call Update(itercount, a(i)) next end function ' NOTE this function is in a separate ( .xla sheet) Module Public Function Update(byval icount as long, byref DomIters as j) ' stuff done in here end function |
HELP "ByRef Argument Type Mismatch"
OPPS, I misstyped.
Public Function Update(byval icount as long, byref DomIters as j) is really Public Function Update(byval icount as integer, byref DomIters as j) Also, the compiler is highlighting the array element in the call function. Bob Phillips wrote: Define itercount as Long not Integer. -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "RocketMan" wrote in message oups.com... I get the compile error: ByRef Argument Type Mismatch at the line Call Upate(itercount, a(i)) and it doesn't make sense to me. I am passing only one element of an array and the types seems fine to me. HELP Here is the example: Private type Iteration Name as string count as integer end type private type j domain as string it() as Iteration end type public function start() dim i, itercount as integer dim a(500) as j itercount = Worksheet("iters").Range("c1") for i = 0 to 499 redim a(i).it(itercount ) as Iteration Call Update(itercount, a(i)) next end function ' NOTE this function is in a separate ( .xla sheet) Module Public Function Update(byval icount as long, byref DomIters as j) ' stuff done in here end function |
HELP "ByRef Argument Type Mismatch"
Public Function Update(byval icount as integer, byref DomIters as j)
Unless 'j' is defined somewhere as a data type, you'll get an error. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting LLC www.cpearson.com (email on the web site) "RocketMan" wrote in message oups.com... OPPS, I misstyped. Public Function Update(byval icount as long, byref DomIters as j) is really Public Function Update(byval icount as integer, byref DomIters as j) Also, the compiler is highlighting the array element in the call function. Bob Phillips wrote: Define itercount as Long not Integer. -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "RocketMan" wrote in message oups.com... I get the compile error: ByRef Argument Type Mismatch at the line Call Upate(itercount, a(i)) and it doesn't make sense to me. I am passing only one element of an array and the types seems fine to me. HELP Here is the example: Private type Iteration Name as string count as integer end type private type j domain as string it() as Iteration end type public function start() dim i, itercount as integer dim a(500) as j itercount = Worksheet("iters").Range("c1") for i = 0 to 499 redim a(i).it(itercount ) as Iteration Call Update(itercount, a(i)) next end function ' NOTE this function is in a separate ( .xla sheet) Module Public Function Update(byval icount as long, byref DomIters as j) ' stuff done in here end function |
HELP "ByRef Argument Type Mismatch"
it IS defined as a type at the top of the file.
private type j domain as string it() as Iteration end type Chip Pearson wrote: Public Function Update(byval icount as integer, byref DomIters as j) Unless 'j' is defined somewhere as a data type, you'll get an error. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting LLC www.cpearson.com (email on the web site) "RocketMan" wrote in message oups.com... OPPS, I misstyped. Public Function Update(byval icount as long, byref DomIters as j) is really Public Function Update(byval icount as integer, byref DomIters as j) Also, the compiler is highlighting the array element in the call function. Bob Phillips wrote: Define itercount as Long not Integer. -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "RocketMan" wrote in message oups.com... I get the compile error: ByRef Argument Type Mismatch at the line Call Upate(itercount, a(i)) and it doesn't make sense to me. I am passing only one element of an array and the types seems fine to me. HELP Here is the example: Private type Iteration Name as string count as integer end type private type j domain as string it() as Iteration end type public function start() dim i, itercount as integer dim a(500) as j itercount = Worksheet("iters").Range("c1") for i = 0 to 499 redim a(i).it(itercount ) as Iteration Call Update(itercount, a(i)) next end function ' NOTE this function is in a separate ( .xla sheet) Module Public Function Update(byval icount as long, byref DomIters as j) ' stuff done in here end function |
HELP "ByRef Argument Type Mismatch"
I get a compile error on such a set up, as you cannot use user defined types
as arguments or return values in public routine. Your type is private, so the Update routine cannot see it. Maybe move to using a Class instead. NickHK "RocketMan" wrote in message oups.com... I get the compile error: ByRef Argument Type Mismatch at the line Call Upate(itercount, a(i)) and it doesn't make sense to me. I am passing only one element of an array and the types seems fine to me. HELP Here is the example: Private type Iteration Name as string count as integer end type private type j domain as string it() as Iteration end type public function start() dim i, itercount as integer dim a(500) as j itercount = Worksheet("iters").Range("c1") for i = 0 to 499 redim a(i).it(itercount ) as Iteration Call Update(itercount, a(i)) next end function ' NOTE this function is in a separate ( .xla sheet) Module Public Function Update(byval icount as long, byref DomIters as j) ' stuff done in here end function |
HELP "ByRef Argument Type Mismatch"
OK, I accept that it isn' t possible. I 'broke up' the type into its
components to pass it. NickHK wrote: I get a compile error on such a set up, as you cannot use user defined types as arguments or return values in public routine. Your type is private, so the Update routine cannot see it. Maybe move to using a Class instead. NickHK "RocketMan" wrote in message oups.com... I get the compile error: ByRef Argument Type Mismatch at the line Call Upate(itercount, a(i)) and it doesn't make sense to me. I am passing only one element of an array and the types seems fine to me. HELP Here is the example: Private type Iteration Name as string count as integer end type private type j domain as string it() as Iteration end type public function start() dim i, itercount as integer dim a(500) as j itercount = Worksheet("iters").Range("c1") for i = 0 to 499 redim a(i).it(itercount ) as Iteration Call Update(itercount, a(i)) next end function ' NOTE this function is in a separate ( .xla sheet) Module Public Function Update(byval icount as long, byref DomIters as j) ' stuff done in here end function |
All times are GMT +1. The time now is 10:29 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com