Closing open embedded windows

D

demo

When I run an automated Bill of Material my Visio opens all embedded windows
to search for tags. After the BOM has been produced these windows are still
running in the processes. I have to manually close them by going into the
task manager. This takes time and depending on the number of embedded
drawings takes needed memory.

Thanks, Derek
 
J

JuneTheSecond

Would you tell us more how did you make the windows and how did you show
them. I thought you could close them, if the windows were shown by your
program
 
D

demo

Here is my code. It opens windows then they stay open in the processes. I
hope this helps...

Public appvis2 As Visio.Document

Public Sub foundembedded(embeddedshape As Visio.shape)
Dim responcy As Double

Set appvis2 = Nothing

On Error Resume Next
Set appvis2 = embeddedshape.Object

If appvis2 Is Nothing Then

Else


If frmdropon.chkembedded.Value = True Then

frmcreate.lblinfo.Caption = "Opening Embedded Documents"


On Error Resume Next
Set appvis2 = embeddedshape.Object

Call createforembeded(appvis2)

Else
responcy = MsgBox("This Document Contains An Embedded Document on
Page: " & SearchVisio.pagsObj(Drop.searchamount) & vbCrLf & "
Do You Wish To Include This In The Search", 4, "Found Embedded Document")

If responcy = vbYes Then
frmcreate.lblinfo.Caption = "Opening Embedded Documents"


Call createforembeded(appvis2)

ElseIf responcy = vbNo Then

End If

End If

End If

End Sub

Public Sub createforembeded(embedded As Visio.Document)
frmcreate.lblinfo.Caption = "Searching Embedded Documents"

Dim hinky As Double
Dim intshapecountforembedded As Double
Dim shpobjforembedded As Visio.shape
Dim shpsobjforembedded As Visio.shapes
Dim numberforembedded As Double
Dim pagsobjforembedded As Visio.Pages
Dim pagobjforembedded As Visio.Page

hinky = 1

Set pagsobjforembedded = embedded.Pages

Do Until hinky > embedded.Pages.Count

Set pagobjforembedded = pagsobjforembedded.Item(hinky)
Set shpsobjforembedded = pagobjforembedded.shapes

intshapecountforembedded = shpsobjforembedded.Count

Do Until intshapecountforembedded = 0

Set shpobjforembedded =
pagobjforembedded.shapes(intshapecountforembedded)

If shpobjforembedded.Type = 2 Then
numberforembedded = shpobjforembedded.shapes.Count

Do Until numberforembedded = 0

If shpobjforembedded.shapes(numberforembedded).Name =
"Tag" Or shpobjforembedded.shapes(numberforembedded).Name = "tag" Or
shpobjforembedded.shapes(numberforembedded).Name = "TAG" Then

Call
Search.foundtag(shpobjforembedded.shapes(numberforembedded))

ElseIf shpobjforembedded.shapes(numberforembedded).Name
= "CustomTag" Or shpobjforembedded.shapes(numberforembedded).Name =
"customtag" Or shpobjforembedded.shapes(numberforembedded).Name = "CUSTOMTAG"
Or shpobjforembedded.shapes(numberforembedded).Name = "Customtag" Then

Call
Search.foundcustomtag(shpobjforembedded.shapes(numberforembedded))

ElseIf shpobjforembedded.shapes(numberforembedded).Type
= 2 Then

Call
Search.foundgroup(shpobjforembedded.shapes(numberforembedded))

End If

numberforembedded = numberforembedded - 1

Loop

End If

intshapecountforembedded = intshapecountforembedded - 1

Loop

hinky = hinky + 1

Loop

End Sub
 
J

JuneTheSecond

I am sorry, but I cannot understand what are frmcreate and frmdropon.
Would you tell me what program language you are using, VBA or VB .Net or...?
 
J

JuneTheSecond

Now, i see frmcreate and frmdropeon. But Now, I cannot understand
SearchVisio.pagsObj(Drop.searchamount). Is it a subroutine?
Any way, I think you can close all forms with a macro like a,
Dim frm As UserForm
For Each frm In UserForms
Unload frm
Next
 
D

demo

Thanks for the reply...

I am using VBA. I tried inserting the macro and it does not seem to work.

I think that the way the code works is that it opens embedded visio drawings
and looks through them then opens the next... It never closes the open
embedded drawings that it opened.

Please let me know if you find a solution.

Derek
 
J

JuneTheSecond

If the UserForms are opened in system modal, no other VBA
could be able to run, so my example could not run. The example
might run if the userforms opened with parameter vbModeless.
You might have embedded Visio drawing that have macro.
The macro might have document opened events and might open
Userform. If so, my idea is you might not to embed such a drawing
, you might make a copy of such a drawing and delete the macro.
 

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