View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Robin Hammond[_2_] Robin Hammond[_2_] is offline
external usenet poster
 
Posts: 575
Default VBA script ActiveX .ocx embedded

Mary,

I didn't say it was impossible, but it is impractical. If you really want to
try it, you will have to create an Object to hold the winsock reference, use
late binding with an error trap if you can't create the winsock object, have
a server somewhere to access to get the file, download the file, register
the file,....

The VS Installer is here

http://msdn.microsoft.com/vstudio/do.../download.aspx

However, having looked at the licensing, it looks like you need at least
part of VS first or it won't run, which may count this out as an option for
you. There may be other installers that you can use given how simple your
installation is. Have a look on Tucows or something similar.

If you don't have VS and therefore can't use the VSI, and can't find an
alternative installer, you will need to figure out how to get the winsock
ocx on to the client machine, then use a command like this to register it,
but once again you may run into rights problems.

strSystemFolder = 'path to system folder on target machine
lRegSvrReturn = Shell("regsvr32.exe /s " & strSystemFolder & "Winsock.ocx")

Robin Hammond
www.enhanceddatasystems.com


"Mary" wrote in message
...
Hi Robin,
Thank you very much for your suggestions.
Unfortunaely it is a must that I use WinSOCK control. That is why I
thought
that maybe if I can attach that component to my spreadsheet or include
that
component in the zip package, when I either open the spreadsheet or the
zip
package it would automatically include this file into the window folder
and
then trigger a registration to occur...
So I guess that this method is impossible?
Could you tell me where I can find more information about this Visual
Studio
Installer?
Thanks for all your help!
Cheers,
Mary

"Robin Hammond" wrote:

Mary,

I think you will have to work on a more reliable approach. In theory it
would be possible to have the winsock file on a server, use late binding
with an error trap, and if the file doesn't exist download it to the
target
then register it with a shell call to regsvr. This is not trivial and is
likely to run into permissioning problems trying to register the ocx
file.

I'd have a look at a very simple installation package that will register
the
ocx on the target machine as part of your original distribution. Your
best
option is probably the Visual Studio Installer. Just add the ocx to the
install package and it should self-register. Again, you will have to
ensure
that you have adequate rights to install the ocx, but you can tell the
client that they need to run the installer with admin priviliges.

An alternative thought? Do you have to use a winsock control. Could you
achieve the same thing using IE or an api call like URLDownloadToFile? If
so
you might be less likely to have a registration problem.

Robin Hammond
www.enhanceddatasystems.com

"Mary" wrote in message
...
Hi,
I am having a lot of trouble trying to allow my client to open up a
spreadsheet with an embedded winsoc.ocx component within.
Because my client doesn't have the component installed on their PC, I
am
trying to come up with a way of embedded the file in the spreadsheet so
that
as soon as the spreadsheet opens, it will allow the file to be moved
(or
copied) to the right directory and then register the component
automatically.
Can someone give me some idea as to whether this would be possible.

Thanks heaps!
Regards,
Mary