Link to home
Start Free TrialLog in
Avatar of Roger
RogerFlag for United Kingdom of Great Britain and Northern Ireland

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.GetSaveAsFilename(options_EndUser_OpenFile_DefaultPath, fileFilterString) 'default defined by Const
    If visFilePath <> "False" Then
        exists = FileFolderExists(visFilePath)
        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(visFilePath)
       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
Avatar of Scott Helmers
Scott Helmers
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Roger

ASKER

Thanks!
Kelvin