View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default How to add code module to Excel programmatically


"deko" wrote in message
m...
I tried this from Excel, and after renaming the variable vbpCpt to

intCpt,
it ran fine for me.


What did you try? There was no variable named vbpCpt in my code.


Okay, so I got the name slightlyu wrong. This is the code, it should have
been vbpCt

Debug.Print "This workbook has " & vbpCt & " modules."

If running this from Excel, you need to set a variable object to the

Excel
app, and qualify each Excel object with that app object.


Do you mean "if running this from Access"... ??


Or an other automation client.

Not sure if that applies equally to VBE objects,
never tried it from another app, but try it anyways.


hmmm... do I need to instantiate VBE objects differently?


Don't know as I said I have never done it, but I would expect so.