Roger
asked on
Opening a second visio file in early binding with Excel, to copy shapes between visio files
I use Excel vba procedures to open and manipulate visio drawings:
To selecting a file in a dialogue box:
visFilePath = Application.GetSaveAsFilen ame(option s_EndUser_ OpenFile_D efaultPath , fileFilterString) 'default defined by Const
If visFilePath <> "False" Then
exists = FileFolderExists(visFilePa th)
dialgBxVisFileChosen = True
Else
dialgBxVisFileChosen = False
Exit Sub
End If
and then early binding:
If Not IsFileOpen(visFilePath) Then
Set visioApp = New Visio.Application 'early binding
Set visQDoc = visioApp.Documents.Open(vi sFilePath)
Set pgs = visQDoc.Pages
end if
Now I want to open a second visio file so I can copy visio shapes from one file to the other.
I'm trying to work out a simple scheme, and worry that I will run into gotchas..
I propose to make two versions of all the variables above, distinguishing a don_vis file (copy domor) and rec_vis file (copy recipient): extending for example:
don_visFilePath & rec_visFilePath
don_visioApp & rec_visioApp etc etc
The inter file copying code would be focused on don_shapes and rec_shapes as members of don_pages and rec_pages collections.
I can send event signals between excel and visio, in either direction, and have copied shapes within single visio files.
What worries me about my simple approach is, inexperience! Where is this simple approach likely to cause me problems?
Thanks, Kelvin4
To selecting a file in a dialogue box:
visFilePath = Application.GetSaveAsFilen
If visFilePath <> "False" Then
exists = FileFolderExists(visFilePa
dialgBxVisFileChosen = True
Else
dialgBxVisFileChosen = False
Exit Sub
End If
and then early binding:
If Not IsFileOpen(visFilePath) Then
Set visioApp = New Visio.Application 'early binding
Set visQDoc = visioApp.Documents.Open(vi
Set pgs = visQDoc.Pages
end if
Now I want to open a second visio file so I can copy visio shapes from one file to the other.
I'm trying to work out a simple scheme, and worry that I will run into gotchas..
I propose to make two versions of all the variables above, distinguishing a don_vis file (copy domor) and rec_vis file (copy recipient): extending for example:
don_visFilePath & rec_visFilePath
don_visioApp & rec_visioApp etc etc
The inter file copying code would be focused on don_shapes and rec_shapes as members of don_pages and rec_pages collections.
I can send event signals between excel and visio, in either direction, and have copied shapes within single visio files.
What worries me about my simple approach is, inexperience! Where is this simple approach likely to cause me problems?
Thanks, Kelvin4
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Kelvin