Post by ralphPost by GSAfter much googling I'm probably going to go with...
Shell "regsvr32 " & gsAppPath & "mscomctl.ocx /s"
Shell "regsvr32 " & gsAppPath & "mscomctl.ocx /u /s"
The location "gsAppPath" is a tad disturbing. Is this a placeholder
or an actual new location (copy)?
Yes, it's a global string variable that contains the path to the app's
install folder, including the trailing backslash. I use it because I
like my code portable between VBA/VB6 projects and so its value is set
at startup along with any other globals in the InitGlobals procedure.
Post by ralphPost by GS..if/when an attempt to 'Load' the userform throws an error. This
will also obviate screwing things up if someone else has registered
the control. (My intent is that it only be available during runtime
of the VBA project if not existing on the host machine)...
On Error GoTo instOCX
Set DF = New fDataFormLV
If Not DF Is Nothing Then DF.Show vbModeless: Exit Sub
Call RegOCX
'Just do once
If iNum = 0 Then iNum = iNum + 1: Resume loadDF _
Else MsgBox sMsg, vbCritical
..and on shutdown...
Call RegOCX(False)
..where RegOCX(Optional LoadOCX As Boolean = True) uses Dir() to see
if the ocx exists in the path and if not found it returns False. It
returns True on success.
Just trying to keep it simple...<g>
It sounds like you are developing a shrink-wrap App for release into
the wild. If so, while I can appreciate this may seem simpler, you
might want to reconsider and use a proven Side-by-Side technology
(Manifest, Reg-Free). It will actually be 'simpler' in the long run.
As stated in numerous other threads, I use a manifest for all my VB6
apps so they are 100% portable. This means they do not change the host
machine in any way, including not using the Registry, and they cleanup
after themselves at shutdown.
I persist 100% portability with my VBA projects as well. Since OCXs
can't be used reg-free in MS Office VBA projects a manifest just won't
work (as I'm sure you know).
My resolve for this issue is this...
my VBA project will register mscomctl.ocx at startup ONLY IF it does
not pre-exist on the host machine. Otherwise it uses existing
'registered' ocx.
IF registered at startup, the ocx is unregistered at shutdown.
The ocx 'lives' in the project's install folder.
This will persist my 100% portability policy AND (as mentioned above)
will not screw up anyone else's registered ocx. The only caveat I see
here is I obviously use v6 SP6 and so if someone else
installs/registers a previous version things get messy. To resolve this
I store the location so it can be re-registered at shutdown. (I just
have to hope user doesn't run its using app during my app's runtime!) I
provide all information/cautions in a readme, which displays 1st
runtime (per user) before the userform using the ocx displays.
Post by ralphOf course these particular components are not a typical case, since
if the target is using Office and mostly Microsoft solutions one is
practically guaranteed they will be there and registered - thus extra
finagling need ever be done. The downside is if they are already
present then it is likely they are heavily shared. Your hijacking the
'global' registration may work well on your test box and for the
single-tasking user, but is likely to fail at the most inopportune
time on a busy box.
As you can see by my earlier comments, I think I have a decent resolve
in place. If, as you state, this situation will most likely be that the
ocx already exists then all is good, right?
The VBA version is for the casual user. The VB6 version runs reg-free
and is what I recommend over the MS Office version because (I have
FarPoint's Spread.ocx and so can duplicate what Excel does so far as my
apps are concerned) In cases where the user needs to work further with
things in Excel, the Spread.ocx converts/exports/imports its workbooks
to/from Excel format. Also, I include data output (no formulas) to CSV
format as an option.
Not saying it's all 'perfect', but I do go the distance with effort to
make it as right as possible!<g>
As always, your sage advice is most appreciated. Thank you for
investing your time/energy!
--
Garry
Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion