Hi

I have a problem with defining variables.

In have a workbook called mybook1.xlsm. At the top of a code module within that workbook I have a public variable declared

Public kdatabase as string

I can use that quite happily in any code modules within mybook1.xlsm.

But if I refer to that variable in a sub that is in my personal.xlsb then i get an error

For example i haver this sub in a code module from the perosnal.xlsb

Sub AddDb
kx=kdatabase
....
End Sub

This generates an error when AddDb when it is called from a sub in mybooks1.xlsm.

Does this mean a public variable is only available to subs from within the same workbook?

If that is not the case how do I define my variable so that it can been seen from both workbooks?

Thanks

Max