On Connection Hell

M

Mark Durrenberger

Ok, I now know more about the situation.
On connection fires normally.
In the onconnection code, I launch a form (frmTest.show(vbmodal)
Somehow, launching this form kicks off another instance of MS Project
With the new instance of Project, OnConnection fires again.
To my knowledge, I am not doing anything to create a new instance of MS
Project?????

Thanks
Mark

the form load event code is below:

Private Sub Form_Load()
Dim strTempFile As String

If gblblnFirstTime = True Then
' put a temporary key into the text box
Me.Label1.Caption = "The key below will allow a 30 day trial. A temporary
key can also be found in the directory."
Me.keyString = "longstringhere"
Else
Me.Label1.Caption = "Please enter a permanent key."
Me.keyString = ""
End If
With picRangerLogo
.Width = ScaleX(291, vbPixels, vbTwips)
.Height = ScaleY(77, vbPixels, vbTwips)
.Left = Me.ScaleWidth / 2 - .Width / 2
.Visible = True
End With
Call oakGetGIFFile(101, strTempFile)
Set picRangerLogo.Picture = LoadPicture(strTempFile)
Kill strTempFile
strTempFile = ""

With lblVersion
.AutoSize = True
.Caption = gblOakVersion
.Move Me.ScaleWidth - .Width, Me.ScaleHeight - .Height
End With

With picMiniLogo
.BorderStyle = 0
.Width = ScaleX(72, vbPixels, vbTwips)
.Height = ScaleY(14, vbPixels, vbTwips)
.Left = Me.ScaleLeft
.Top = Me.ScaleHeight - .Height
End With
Call oakGetGIFFile(103, strTempFile)
Set picMiniLogo.Picture = LoadPicture(strTempFile)
Kill strTempFile

End Sub

--
_________________________________________________________
Mark Durrenberger, PMP
Principal, Oak Associates, Inc, www.oakinc.com
"Advancing the Theory and Practice of Project Management"
________________________________________________________

The nicest thing about NOT planning is that failure
comes as a complete surprise and is not preceded by
a period of worry and depression.

- Sir John Harvey-Jones
 
M

Mark Durrenberger

I've written an add-in for MS Project it implements idextensibility2

When I launch my office application (MS Project) On connection fires
normally.
In the onconnection code, I launch a form in the usual manner: frmTest.show
(vbmodal)
Somehow, launching this form kicks off another instance of MS Project
With the new instance of Project, OnConnection fires again. and shows the
form again.
The onconnection code *only* fires twice...
I found this through brute force - commenting out lines ...

Turns out, the formload code called a procedure that puts a graphic on the
form. The graphic handler needed a place to manipulate graphics so I used
"application.path" & "\" & filename .....

application.path triggered a new instance of project.
The fix, quite simple,
use the stored instance of the application (done earlier in the program)
dim AppInstance as Object
set AppInstance = Application (Application is the application object passed
to the OnConnection code)

Hope this makes sense,
Mark

--
_________________________________________________________
Mark Durrenberger, PMP
Principal, Oak Associates, Inc, www.oakinc.com
"Advancing the Theory and Practice of Project Management"
________________________________________________________

The nicest thing about NOT planning is that failure
comes as a complete surprise and is not preceded by
a period of worry and depression.

- Sir John Harvey-Jones
 
T

Tom Winter

You might also want to move that code to OnStartupComplete() rather than
OnConnection. I can't give you a super good technical reason off the top of
my head, but it would seem more appropriate.
 
M

Mark Durrenberger

This makes sense and I too don't have a tech reason either.
Thanks
Mark

--
_________________________________________________________
Mark Durrenberger, PMP
Principal, Oak Associates, Inc, www.oakinc.com
"Advancing the Theory and Practice of Project Management"
________________________________________________________

The nicest thing about NOT planning is that failure
comes as a complete surprise and is not preceded by
a period of worry and depression.

- Sir John Harvey-Jones
 

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