Hi, Mike. I never thought of that approach. Almost all
of these files are actual Word docs, created and saved in
Word by someone else and passed along to me. With a
graphic or metafile (I'll have to look into that - I've got
Word 2000), I'm assuming I would create a separate form
with a single control, load the metafile into the control and
make that form visible. SInce VB is still the running app,
I can then code anything I want to control the viewing and
closing. Does that sound right?
Yep. That's about it. The first step would be to convert your Word docs into
suitable graphic files that can be loaded into a standard VB PictureBox
(.bmp, .jpg, .gif, .wmf or .emf). Any other kind of graphic file would
require you to use a third party control instead of a standard VB PictureBox
to display them, so it is probably be best to stick to one of those I've
mentioned. The first three file types mentioned are types of bitmap and the
last two are types of metafile. Bitmaps of line drawings and text and stuff
don't scale very well when you resize them whereas metafiles rescale fine,
so I would suggest either .wmf or .emf. Of the two .emf is the most
versatile. So, all you need to do is find a way of converting your existing
MS Word docs to .emf files and you will then be able to very easily display
the metafile at any size you require in a VB PictureBox.
I use Word 2007 Ultimate myself and I've just checked now and it does not
allow me to convert or save a Word document as any of the above graphic
formats. If 2007 Ultimate does not do it then I'm fairly sure Word 2000 will
not do it either (although it is always worth you checking that out). It
does allow me to save as various kinds of web pages (which you could open in
a Browser control on your VB Form) but web pages don't preserve the
formatting of your Word document and they're not scaleable in ther way that
an image file is, so I wouldn't bother with them.
If you happen to have the full Office Suite, including MS Publisher, then
you could use Publisher to create your metafile. Just press CtrlA in your
Word document to select all followed by CtrlC to copy it to the clipboard.
Then in Publisher use the File / Paste Special menu and select Picture
(Enhanced Metafile) from the list. This will paste the Word document exactly
as it is laid out in Word into the Publisher document. You will then be able
to use the Publisher File / Save As menu and select Enhanced Metafile (.emf)
as the file type. I'm not sure if Publisher 2000 would offer the same
functionality as my own Publisher 2007 does, but its worth checking out.
If you don't have MS Publisher or anything else that offers the same
functionality then you could download and install a virtual Printer Driver
that can create metafiles. One such driver is PoleStar Virtual printer and
you'll find it at:
http://www.polestarsoft.com/virtual_printer/
It is completely freeware and there are no time limitations or anything. It
installs itself as a printer driver and once you have installed it (and set
up its options to your liking, including setting it to produce emf files
rather than the various other files it is capable of outputting) you can use
it to create an .emf file from any application that is capable of printing
(which means just about anything!). Just open your Word doc as normal and
use its File / Print menu. In the Print Dialog select the PoleStar Virtual
Printer (instead of your usual printer) and it will create and save an .emf
file for you. It only claims to be for Win 2000/ Win XP but it is possible
to get it going on Vista with a bit of work. I managed to get it running
okay on Vista myself today, and it works when set to save .emf files to a
default folder, but it does not work when you set it to bring up a file save
box. It produces good emf files though.
Just one point about emf files is that many applications that produce them
(such as MS Publisher and this PoleStart Printer Driver) do not give you an
option regarding how you want them to save text. This means that they save
it in the usual default way as a description of the Font and font details
used in various parts of the document, together with the character codes
etc. This means that such metafiles will only display correctly on machines
which themselves actually have all the fonts you have used installed. In
your case I imagine you have used some special music fonts (?). If so then
they are likely to be unavailable on machines other than your own. If that
is the case, and if you want the image to display properly on machines other
than your own, you have a choice of loading the .emf file into something
like Corel Draw and saving it out from Corel Draw selecting the "save text
as curves" option or alternatively adding code to your VB program to
temporarily install the font on the user's machine (l;icence restrictions
permiting) or you can save the file as some other type of graphic that does
not use fonts (jpeg for example). I would suggest sticking to .emf though
and using one of the other options. If there are only standard fonts in your
Word doc then of course it won't be a problem anyway.
Anyway, I've covered just a few of your options and there are certainly many
others. I'm off on holiday in the morning and so I won't see any of your
responses, but there are lots of others here who will help you with this.
Mike