Strange file search behaviour of Documents.OpenEx()

N

Niklas Deutschmann

Hi,

I just made a strange observation while investigating a performance problem
with my add-in that caused loading documents to take 5-6 minutes on some
computers.

Documents.OpenEx() seems to search the "My Shapes" directory and all
subdirectories *even* when you pass an absolute filename.
On the machines that showed the performance problem, "My Shapes" was set to
"My Documents" (not "My Documents\My Shapes") for whatever reason.

Steps to reproduce:
- Set the "My Shapes" path to C:\ using "Tools", "Options", "Advanced",
"File Paths"
- Create a stencil and put it into some "subdirectory" of C:\
- Create an empty document with a macro that loads this stencil using the
full pathname:

Application.Documents.OpenEx "C:\subdirectory\stencil.vss",
VisOpenSaveArgs.visAddDocked

- Restart Windows(*), start Visio, open this document, and execute the macro
=> Loading the stencil takes several minutes

Is there any public documentation of this behavior of Documents.OpenEx()? I
don't find anything in the Visio 2007 automation reference.

I'm using Microsoft Office Visio 2007 (12.0.6336.5001) SP1 MSO
(12.0.6320.5000)

(*) Searching for files seems to be faster on subsequent executions because
of some Windows caching/indexing

Niklas
 
P

Paul Herber

Hi,

I just made a strange observation while investigating a performance problem
with my add-in that caused loading documents to take 5-6 minutes on some
computers.

Documents.OpenEx() seems to search the "My Shapes" directory and all
subdirectories *even* when you pass an absolute filename.
On the machines that showed the performance problem, "My Shapes" was set to
"My Documents" (not "My Documents\My Shapes") for whatever reason.

Steps to reproduce:
- Set the "My Shapes" path to C:\ using "Tools", "Options", "Advanced",
"File Paths"
- Create a stencil and put it into some "subdirectory" of C:\
- Create an empty document with a macro that loads this stencil using the
full pathname:

Application.Documents.OpenEx "C:\subdirectory\stencil.vss",
VisOpenSaveArgs.visAddDocked

- Restart Windows(*), start Visio, open this document, and execute the macro
=> Loading the stencil takes several minutes

Is there any public documentation of this behavior of Documents.OpenEx()? I
don't find anything in the Visio 2007 automation reference.

I'm using Microsoft Office Visio 2007 (12.0.6336.5001) SP1 MSO
(12.0.6320.5000)

(*) Searching for files seems to be faster on subsequent executions because
of some Windows caching/indexing

With a path covering that many possible files it could be that the
initial stencil discovery is taking a long time but running as a
background thread, your initial OpenEx might be being delayed because
of this.
 

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