dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,375
- Office Version
- 365
- 2016
- Platform
- Windows
I have a message box that is displayed if another user already has a file open on my network. I want to make the text within the message box bold "without saving them". Could someone tell me how I do this please?
VBA Code:
Private Sub Workbook_Open()
Dim file1 As Integer
Dim strLine As String
file1 = FreeFile
If Not ActiveWorkbook.ReadOnly = True Then
'only add name to the usage log if the user has it locked
Open ThisWorkbook.Path & "\usage.log" For Append As #file1
Print #file1, Environ("USERNAME") & ". Please close all the additional workbooks that will be opened " _
& "without saving them. Then contact the user that has it open or wait until they are finished."
Close #file1
Else
'if someone else has the file open, find out who
Open ThisWorkbook.Path & "\usage.log" For Input Access Read As #file1
Do While Not EOF(file1)
Line Input #file1, strLine
Loop
Close #file1
MsgBox "The following user has the allocation sheets open: " & strLine
End If
End Sub