How do I save an embedded item from a worksheet into a folder

A

Alan

Hi All,

Does anyone know how I can save an embedded object (file) from a
worksheet into a folder on a hard disk?

I have a worksheet with mscal.ocx embedded just in case the user does
not have the calendar control.

I can check to see if they have it already on their hard disk using
VBA, and I know how to register it using VBA, but I don't know how to
actually extract it from the worksheet and save it onto their hard
disk.

I can select the object from the active worksheet using:

ActiveSheet.Shapes("ObjName").Select

and I could then copy it to the clipboard:

Selection.Copy

but pasting it to a folder appears to be outside the scope of the VBA
object model?

Thanks in advance for any suggestions.

Alan.
 
T

Tom Ogilvy

That wouldn't work anyway, so no need to struggle with it.

If you want to install the control on a users computer, you will need to
have the files that define the control and install them.
 
A

Alan

Tom Ogilvy said:
That wouldn't work anyway, so no need to struggle with it.

Hi Tom,

Thanks for your reply.

Does that mean it is impossible to do it purely through the
distribution of the xls file?

Do I have to find some other way to get the file onto their hard disk?
I'm not really familiar with this, so I am not quite sure what you
mean by:
If you want to install the control on a users computer, you will need
to have the files that define the control and install them.

As far as I know, there is only one file (mscal.ocx). To do it
manually, I just drop that file into the correct folder on their PC,
and then register it using VBA:

Shell ("regsvr32.exe mscal.ocx")

Therefore, I think it is only this part that is stopping me:
you will need to have the files that define the control

But I definately have the file - it is just how to actually distribute
it that I cannot figure out.


Apologies if I am missing the point - I haven't tried this before.

Thanks for your assistance,

Alan.
 
T

Tom Ogilvy

As far as I know, there is only one file (mscal.ocx). To do it
manually, I just drop that file into the correct folder on their PC,
and then register it using VBA:

Shell ("regsvr32.exe mscal.ocx")

that is what I mean. You can't embed that file in your xls file.

When you install software produced by a commercial entity, there is usually
an install routine that does the above. If all you are doing is passing
around an xls, then you probably need to also pass the OCX and instructions
how to register it, or have them put it in the same directory as your xls
and have code in the xls that copies it to the correct directory and runs
the shell command.
 
A

Alan

Tom Ogilvy said:
When you install software produced by a commercial entity, there is
usually an install routine that does the above. If all you are
doing is passing around an xls, then you probably need to also pass
the OCX and instructions how to register it, or have them put it in
the same directory as your xls and have code in the xls that copies
it to the correct directory and runs the shell command.

Thanks Tom.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top