Thread: Import module
View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Peter T[_5_] Peter T[_5_] is offline
external usenet poster
 
Posts: 84
Default Import module

Charlotte,

It contains XL2007 code, which won't complie under XL2003 - so, I check
for Application.Version, and import the module if Version is 11.


If the prohect is locked it's tricky to lock & relock. It can be done
without SendKeys but overkill for your purposes. Even if the project is not
locked User's security settings will need to "trust access to VBProject"

There are workarounds, it depends what you are doing but the simplest is
don't fully declare any objects that prefix later version stuff, eg

Dim rng as Range, oRng as Object

If vers <=11 then
set rng = rng.2003-stuff
Else
Set oRng = oRng.2007/2010-stuff
Set rng = oRng
End if

That's contrived just for ideas, maybe different procedures for 2003 / 2007.

Clif,

Sounds to me like a place for conditional compiler code ... no time to
pull up an example just now; reply if you want more information. Open up
the VBE and enter conditional compile in the help box.


Problem is you can't change the conditional arguments after distributing
without access to the project, in effect back to square one.

Peter Thornton