Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable integration with ProjectWise

Status
Not open for further replies.

Andrzejek

Programmer
Jan 10, 2006
8,486
5
38
US
How can I disable integration with ProjectWise in Word’s VBA?
Recording a macro in Word comes empty :-(

PW_tq0eur.png


---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Funnily enough was engaged in an international ProjectWise deployment earlier today ...

Not really involved on trhe application side though ... as I recall Projectwise integration is done through a C OM addin - so we could programmatically disable the addin, eg:

Code:
[blue]Sub toggleprojectwisecomaddin()
    Dim lngIndex As Long
    For lngIndex = 1 To Application.COMAddIns.Count
        If Application.COMAddIns(lngIndex).Description = "ProjectWise iDesktop Integration" Then [COLOR=green]' possible your Projectwise comm addin  name may vary[/color]
            Application.COMAddIns(lngIndex).Connect = Not Application.COMAddIns(lngIndex).Connect [COLOR=green]' toggle connect status[/color]
            Exit For
        End If
    Next
End Sub[/blue]
 
Detected: "ProjectWise iDesktop Integration" :)
Tried:
[tt]Application.COMAddIns(lngIndex).Connect = Not Application.COMAddIns(lngIndex).Connect[/tt]
and
[tt]Application.COMAddIns(lngIndex).Connect = False[/tt]

Got:
This add-in is installed for all users on this computer and can only be connected or disconnected by an administrator. :-(

Is there a way to just Disable it?

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
A dirty trick that may help is to open word in safe mode. It will run without any extensions.
Either open word with Ctrl key pressed or run from command line with /safe switch. Addin can be disabled with /a switch ( If any of switches works, it is possible to create shortcut to word with specific switch.

combo
 
Thanks combo, but I run Word from VB(6) app and user does not even see Word on the screen.
I just create a whole bunch of docx files and save them also as pdf files to the server behind the scenes.
ProjectWise just causes some issues in this process...[mad]

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
>Is there a way to just Disable it?

Bentley themselves only document two ways.: using the disable button on the menu, or the Connect method illustrated above (albeit not a code version - "You can disable integration from inside the application by clicking the File menu , selecting Options > Add-Ins > Com Add-ins, and turning off the ProjectWise add-in you want to disable")

The COMAddin itself does not expose any methods that can be used by VBA that I can find. Perhaps you can ask Bentley themselves
 
If the path to Winword.exe is known, you can open Word using Shell, and having switch (/a) added to the patch. Next get Word with GetObject.

combo
 
/a doesn't stop com addins ... You need /safe - and /safe causes a startup dialog the user would need to click ...
 
strongm said:
/a doesn't stop com addins ...
MS description of office switches, for word:
[tt]/a
Starts Word and prevents add-ins and global templates (including the Normal template) from being loaded automatically. The /a switch also locks the setting files.[/tt]

For me, Application.COMAddIns.Count in Immediate window, returns 2 if word started normally, run-time automation error if by 'winword.exe /a' in command line. However, there is no difference in COMaddins window.

combo
 
If Word is closed, picking word on my computer as below takes around 3 seconds if it was previously open, up to around 15 for fresh windows session. If Word is running, GetObject finds first task, don't know the way to get specific ID.

Code:
Public Sub Test()
Dim appWord As Word.Application
On Error Resume Next
    Set appWord = GetObject(, "Word.Application")
    If Err.Number = 0 Then
    MsgBox "Close Word and start again"
    Set appWord = Nothing
Else
    Err.Clear
    On Error GoTo 0
    ID = Shell("winword.exe /a", vbMaximizedFocus)
    Set appWord = GetWord(30)
    If appWord Is Nothing Then
        MsgBox "Need a bit more time..."
    Else
        appWord.Visible = True
    End If
End If
End Sub

Public Function GetWord(MaxWaitSeconds As Integer) As Word.Application
On Error Resume Next
For i = 1 To MaxWaitSeconds
    Application.Wait (Now + TimeValue("0:00:01"))
    DoEvents
    Set GetWord = GetObject(, "Word.Application")
    If Err.Number <> 0 Then Err.Clear Else Exit For
Next i
MsgBox i
End Function

combo
 
Long story short…
Since there is no way (AFAIK) to control ProjectWise Desktop Integration Add-In thru VBA code, I simply decided to allow users to start Word (that’s on Citrix) and allow them to Disable ProjectWise.
If I cannot do it (as a programmer), then I simply say to the user: “You do it yourself.”
Not a very high-tech approach… [sad]


---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top