VApp.Documents.Open(PathFileName), File not found.

C

Caroline

I tried to write this standalone VB6 application:

Private Sub btnRun_Click()
Dim PathFileName As String
On Error GoTo ErrbtnRun_Click

PathFileName = Text1.Text
Set VApp = CreateObject("Visio.Application")
Err = 0 ''GetLastError() value

Set Vdoc = VApp.Documents.Open(PathFileName)

Dim AShape As Visio.Shape
Dim pageObject As Visio.Page
For ipagctr = 1 To Vdoc.Pages.Count
'MsgBox "ipagctr=" & ipagctr
Set pageObject = Vdoc.Pages(ipagctr)
...

the programs runs fine when PathFileName is "C:\mini .vsd"

When however I try to open "C:\Documents and Settings\Administrator\My
DocumentsDrawing1 temp.vsd", I get a "File not found." error.
Why?
 
A

Al Edlund

two quick questions. Did you intentionally leave out the back slashes in
your example (probably two of them)? Do you have administrators clearance/
logged on as administrator to go to that directory? Finally consider putting
a debug.print statement in (debug.print pathfilename) to see what is
actually being passed.
al
 
C

Caroline

Al Edlund said:
two quick questions. Did you intentionally leave out the back slashes in
your example (probably two of them)?
I actually got the path-filename from a FileListBox.
Now I added the xtra slashes, the error is still occuring
Do you have administrators clearance/
logged on as administrator to go to that directory?
Yes

Finally consider putting
a debug.print statement in (debug.print pathfilename) to see what is
actually being passed.
C:\\Documents and Settings\\Administrator\\My
Documents\\__Projects__\\3 - VisioDrawing1_ext.vsd
Should I add quotes somewhere?
 

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