Visio Peculiar Behaviour

Started by elistein, May 12, 2015, 09:28:23 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

elistein

Hi

I have a problem tht drives me crazy for several days:

With Visio 2003 I have a Drawing with more then 400 Buttons and TextBoxes.

Everythind works fine until I added "RunModeEntered", which also works fine. U N T I L ....

Tested on 2 other computers, which are identical with the first one, but there

RunModeEntered doesn't fire. If i start a new Drawing with only this code' it works.

In my despair I uninstalled  ALL Microsoft Office, cleaned drive C and cleaned Registry

on all 3 computers and Reinstalled only Visio 2003.

Unbelievable, exactly the same: First computer fires the other two don't.

Any Ideas???

Yacine

Yacine

elistein

Hi

Finally found the reason, but dont know how to solve it properlly.

In the first computer I previously installed   Visual Basic 6, and when i needed

Common Dialog Control version 6 it just was there, but not on the other 2 computers.

My problem is how to add this control without installing Visual Basic.

Many thanks

elistein

Hi Yacine

RunModeEntered Mkes program to start with this Sub

But as you can see this is not the problem


Yacine

What do you need the common dialog for?
Yacine

elistein

Hi Yacine

Thanks for your reply.

I need a code for Visio to implement like a "BROWSE"

There are many examples, but can't find one that

works for Visio 2003

Yacine

Hi Elistein,
to make it short: I suspect you are looking for a file dialogue.
There isn't one in Visio! One way to help yourself is to use Excel's integrated functionality.


Public Function OpenFile()
On Error GoTo ErrHandler
    Dim filenames As String
    Dim vFile As Variant
    Dim xlsApp As Excel.Application

    ' Use Excel's File Dialog
    Set xlsApp = New Excel.Application
    xlsApp.Visible = True
    vFile = xlsApp.GetOpenFileName("Visio File (*.vsd),*.vsd", 1, "Open File", "Open", False)
    xlsApp.Visible = False

    ' Open the file in Visio:
    If TypeName(vFile) = "String" Then
        Dim theDoc As Visio.Document
        Dim shp As Visio.Shape
        Dim sel As Visio.Selection
        Dim thePage As Page
        Set thePage = ActivePage
   
        ' Datei öffnen, Inhalt gruppieren und in shp zwischenspeichern
        Set theDoc = Application.Documents.OpenEx(vFile, visOpenHidden + visOpenRO)
        'The file is now opened, the ActiveDocument shows it.
        'Do something or leave

        ' You can close it if wanted
        Application.AlertResponse = 7
        theDoc.Close
        Application.AlertResponse = 0
        MsgBox "Operation finished"
    End If
Exit_Func:
    Set theDoc = Nothing
    Application.AlertResponse = 0
    Exit Function
ErrHandler:
    Debug.Print "Error in FileOpen "; Err.Description
    Resume Exit_Func


End Function
Yacine

AndyW

Live life with an open mind

elistein

#8
Yacine, thanks for your suggestion.

After minor modifications:
Dim xlsApp As Excel.Application      >>>  .Visio                     
and
Set xlsApp = New Excel.Application  >> Visio

it's working.  But Your code actually starts a new file,

I need to "browse" to a certain folder, to see the files and to choose one.

Finally found an example that does exactly that:

http://visguy.com/vgforum/index.php?topic=738.0

And that solves my problem.

Still remained with the other Post about disable the X in the right corner (Did it successfully in VB6)

Thanks for everything
elistein

elistein

Hi AndyW

Thank you for your advice but then the code will work only on
computers that have VB6

Yacine

Hi Elistein,
you need to keep the code as I posted it. You way however need to reference the excel library.
Keep "Excel", browse for the file name, once you get it you continue with plain Visio.
Yacine

AndyW

If your code is using a VB6 runtime dll/ocx then you should be distributing that with your application.
Live life with an open mind

elistein

Hi
Thanks everybody for your much appreiciated help .