Setting Visio document name

T

Torben B Haagh

I would like to set the name of the document in code. The Visio document
properties Name and FullName are get properties only, so they cannot be
used. I can live with having to do a save as, but that does not work for me
either.

Using Application.DoCmd(visCmdFileSaveAs) changes the document name, but
does not allow you to give an initial file name.

Using SaveFileDialog and Document.SaveAs or SaveAsEx lets you control the
initial name, but that does not change the name of the document (which I
believe is a bug).

Does anyone know how I can change the document name and control the initial
name?

Thanks,

Torben
 
D

Dieter Sternberg

It is possible but a bit tricky.
You have to fool Visio by using the API function ::SetWindowText to
overwrite Visios Caption.
But you have to do this on certain points (eg. after Save and SaveAs).
So you have to catch the appropriate events, and set a flag that you can
use in Visio_IsIdle.
Must be done in IsIdle to be sure you change the caption *after* visio
is done with it.
I use this within an addon and it works fairly well.

Dieter

Torben B Haagh write:
 
T

Torben B Haagh

Thank you. I made it work, but it did not seem to work in all situations for
me.

I will ask Chris Hopkins for guidance. If a learn a better way, I will post
it here as well.

Torben
 

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