View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default User Public Type, circular dependancy error

You are omitting the relevant portions of the code. The minimalist
description you write leads to code like

Public Type uSx
L As Long
M As Long
End Type

Public Type uRecA
L As Long
M As Long
T As uSx
End Type

Sub AAA()
Dim S As uSx
Dim A As uRecA
S.L = 1
S.M = 2
A.L = 3
A.M = 4
A.T = S

Debug.Print S.L, S.M, A.L, A.M, A.T.L, A.T.M
Debug.Print uSxMakeF(S, 10)

End Sub

Function uSxMakeF(x As uSx, y As Long) As Long
uSxMakeF = x.L + y
End Function


This code works fine. Without seeing more code, it is difficult to
come up with an answer.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com




On Wed, 3 Mar 2010 09:04:01 -0800, Neal Zimm
wrote:

Hi,

In a module I have in declarations,
Public Type uSx
var names...
end type

In same module , general code, a function, uSx = uSxMakeF(arg, arg, ....)
All was working well.

I moved the uSx record definition to another module, "above" uRecA, whe
Public Type uRecA
other vars ...
uSx as uSx
end type

I now get circular dependancies compile error pointing at the above function.
uRecA is not involved in the function.

What is the best practice module batting order that will get rid of this
error ??
I had thought that as long as the "user" of public types was below, or in a
module after the Public Type, that I would not get this error.

Me experience had been that in the uRecA example, as long as other public
types that it used were "above" it, the "find it to use it" requirement
would be met.

Thanks,