D
DS
Morning all,
Was wondering if anyone has a way to do the following...
From a submission form, data is transferred to a destination data table, set
up also in Excel. Should the data table currently be open by another user,
the submit abandons.
The standard "Workbook.xls is locked for editing by user XXXXX" message with
the option to Read Only/Notify etc has been replaced with a message stating
that the submit cannot be completed because someone else has the wb open -
not a problem. The data table closes etc blah blah.
What I'm wondering is whether anyone is familiar with a method whereby the
user that has the wb open can be extracted and placed into a custom message
such as the one above - so that if a single user has the data table open for
a significant period, he/she can be identified and hit round the head....
The code used, in case this is helpful, is:
****************
Application.DisplayAlerts = False
Workbooks.Open DB, ignorereadonlyrecommended:=True, Notify:=False
Application.DisplayAlerts = True
Set DBT = ActiveWorkbook
If DBT.ReadOnly = True Then
DBT.Close SaveChanges:=False
ThisWorkbook.Activate
Sheet1.Select
StrMsg = "The database is currently in use by another user. Please try
again later."
MsgBox StrMsg, vbCritical, "Submission Cancelled"
Exit Sub
End If
****************
And effectively, I would like to add the network logon id of the user who
currently has the target wb open to the StrMsg - which would normally appear
in the "standard" message if DisplayAlerts <> False.
Any ideas?
Thanks!
Was wondering if anyone has a way to do the following...
From a submission form, data is transferred to a destination data table, set
up also in Excel. Should the data table currently be open by another user,
the submit abandons.
The standard "Workbook.xls is locked for editing by user XXXXX" message with
the option to Read Only/Notify etc has been replaced with a message stating
that the submit cannot be completed because someone else has the wb open -
not a problem. The data table closes etc blah blah.
What I'm wondering is whether anyone is familiar with a method whereby the
user that has the wb open can be extracted and placed into a custom message
such as the one above - so that if a single user has the data table open for
a significant period, he/she can be identified and hit round the head....
The code used, in case this is helpful, is:
****************
Application.DisplayAlerts = False
Workbooks.Open DB, ignorereadonlyrecommended:=True, Notify:=False
Application.DisplayAlerts = True
Set DBT = ActiveWorkbook
If DBT.ReadOnly = True Then
DBT.Close SaveChanges:=False
ThisWorkbook.Activate
Sheet1.Select
StrMsg = "The database is currently in use by another user. Please try
again later."
MsgBox StrMsg, vbCritical, "Submission Cancelled"
Exit Sub
End If
****************
And effectively, I would like to add the network logon id of the user who
currently has the target wb open to the StrMsg - which would normally appear
in the "standard" message if DisplayAlerts <> False.
Any ideas?
Thanks!