Dasal Kalubowila
Dasal Kalubowila

Reputation: 123

ActiveWorkbook.ConnectionsDisabled is giving compile error

I have written this code to enable connection:

Sub EnableConnection()

ActiveWorkbook.EnableConnections
answer = MsgBox("Connection enabled")

End Sub

and it works beautifully. However, when write the reverse:

Sub disableConnection()

ActiveWorkbook.ConnectionsDisabled

End Sub

I get Compile error:

invalid use of Property

.

Can anyone help me fix this?

thank you in advance.

Upvotes: 1

Views: 794

Answers (1)

Vityata
Vityata

Reputation: 43595

The code

ActiveWorkbook.ConnectionsDisabled

is a property, not a function. This means that it has a value, but it cannot do anything by itself. It just tells the status of the connection. To see what I mean, go to the immediate window of VBA and write ?ActiveWorkbook.ConnectionsDisabled you would get either true or false, depending on the status.

Upvotes: 1

Related Questions