View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Calling Function in Add-in

That's not enough information.

Is the code in the ThisWorkbook module? Or behind a worksheet?

Select your project in the project explorer in the VBE and click on
Insert|Module.

Then move (not copy) your code there.

MikeH2 wrote:

Personal.xla is open and the module type pulldown at the top says (General)

"Dave Peterson" wrote:

It sounds like personal.xla isn't open.

Or maybe IsOpenWB isn't in a general module.



MikeH2 wrote:

In a VBA Sub, I issue this command:

Dim IsItOpen As Variant
IsItOpen = Application.Run("personal.xla!IsOpenWB", "chart of accounts.xlsx")

And the function in personal.xla is:
Public Function isopenwb(ByVal WBname As String) As Boolean
'returns true if workbook is open
Dim objWorkbook As Object
On Error Resume Next
isopenwb = False
Set objWorkbook = Workbooks(WBname)
If Err = 0 Then isopenwb = True
End Function

But I get an error, "The Macro 'personal.xla!IsOpenWB' cannot be found.
Ideas?


--

Dave Peterson


--

Dave Peterson