+ Reply to Thread
Results 1 to 13 of 13

VBA script ActiveX .ocx embedded

Hybrid View

  1. #1
    Mary
    Guest

    VBA script ActiveX .ocx embedded

    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

  2. #2
    Robin Hammond
    Guest

    Re: VBA script ActiveX .ocx embedded

    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" <[email protected]> wrote in message
    news:[email protected]...
    > 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




  3. #3
    Mary
    Guest

    Re: VBA script ActiveX .ocx embedded

    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" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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

    >
    >
    >


  4. #4
    Robin Hammond
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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" <[email protected]> wrote in message
    >> news:[email protected]...
    >> > 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

    >>
    >>
    >>




  5. #5
    Mary
    Guest

    Re: VBA script ActiveX .ocx embedded

    Hi Robin,
    Yeah I can see that it is going to be a bit of trouble, I don't think I have
    a problem moving the .ocx file into the right folder and registering, but my
    biggest headache is putting the file into the client's PC, because the client
    isn't very PC literate, that is why I need to make it as simple as possible
    for the user, and not needing the user to download the file themselves. I
    thought about zipping up the spread sheet with the .ocx file inside the same
    zip file, so that when the person unzip then it would automatically move the
    component from the unzipped directory into the window folder when the Excel
    sheet open (guess I will have to do this with VBA)...
    But I wasn't sure if it is possible to embedded the file into the Excel
    sheet so that I can save myself the trouble having to zip up the files, the
    client having to unzip the files, and any other implications that might lurk
    in this method...

    Thanks,
    Mary

    "Robin Hammond" wrote:

    > 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" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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" <[email protected]> wrote in message
    > >> news:[email protected]...
    > >> > 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
    > >>
    > >>
    > >>

    >
    >
    >


  6. #6
    Robin Hammond
    Guest

    Re: VBA script ActiveX .ocx embedded

    Mary,

    If you want to try it, the code for a download might look something like
    this but there are plenty of perils in this approach. n.b. I have not tested
    this.

    'API file download call
    Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
    "URLDownloadToFileA" (ByVal pCaller As Long, ByVal strURL As String, _
    ByVal strFileName As String, ByVal dwReserved As Long, _
    ByVal lpfnCB As Long) As Long

    Sub TestForWinsock()
    Dim WS As Object
    Dim lReturn As Long
    Dim lRegSvrReturn As Long
    Dim strFullURL As String
    Dim strLocation As String

    'run this before you do anything else then try and use late binding for the
    winsock
    'there might be a problem with a withevents statement but I can't test it

    On Error Resume Next
    Set WS = CreateObject("MSWinsock.Winsock")
    On Error GoTo 0

    If WS Is Nothing Then

    'uncomment the next two lines and set these two variables
    'strfullurl = path to the winsock.ocx file on the net
    'strLocation = path to save the file, presumably the system folder

    'this assumes you can write a file to the system folder!
    lReturn = URLDownloadToFile(0, strFullURL, strLocation, 0, 0)

    'this ignores permissioning problems with registration!
    If lReturn = 0 Then _
    lRegSvrReturn = Shell("regsvr32.exe /s " & strLocation)

    End If

    Set WS = Nothing

    End Sub

    Robin Hammond
    www.enhanceddatasystems.com


    "Mary" <[email protected]> wrote in message
    news:[email protected]...
    > Hi Robin,
    > Yeah I can see that it is going to be a bit of trouble, I don't think I
    > have
    > a problem moving the .ocx file into the right folder and registering, but
    > my
    > biggest headache is putting the file into the client's PC, because the
    > client
    > isn't very PC literate, that is why I need to make it as simple as
    > possible
    > for the user, and not needing the user to download the file themselves. I
    > thought about zipping up the spread sheet with the .ocx file inside the
    > same
    > zip file, so that when the person unzip then it would automatically move
    > the
    > component from the unzipped directory into the window folder when the
    > Excel
    > sheet open (guess I will have to do this with VBA)...
    > But I wasn't sure if it is possible to embedded the file into the Excel
    > sheet so that I can save myself the trouble having to zip up the files,
    > the
    > client having to unzip the files, and any other implications that might
    > lurk
    > in this method...
    >
    > Thanks,
    > Mary
    >
    > "Robin Hammond" wrote:
    >
    >> 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" <[email protected]> wrote in message
    >> news:[email protected]...
    >> > 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" <[email protected]> wrote in message
    >> >> news:[email protected]...
    >> >> > 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
    >> >>
    >> >>
    >> >>

    >>
    >>
    >>




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1