Hi
I have a shared workbook with a VBA userform that copies information users complete into a worksheet. this works great when the userform is opened only by one person at a time, however if multiple users are in the form the last person to press send gets the resolving conflicts message, asking them to pick which data to copy to the sheet.
Does anyone know i would allow multiple user to send there data without getting the conflicts message.
I have a shared workbook with a VBA userform that copies information users complete into a worksheet. this works great when the userform is opened only by one person at a time, however if multiple users are in the form the last person to press send gets the resolving conflicts message, asking them to pick which data to copy to the sheet.
Does anyone know i would allow multiple user to send there data without getting the conflicts message.
Code:
'send via the Form send button the completed information to New'
Private Sub SendButton_Click()
On Error Resume Next
Dim iRow As Long
Dim ws As Worksheet
Dim textBoxes() As Textbox
'finds the name of the New'
Set ws = Worksheets("New")
'find first empty row in database'
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'check for a Name'
If Trim(Me.TextBox1.Value) = "" Then
Me.TextBox1.SetFocus
MsgBox "Please complete name feild "
Exit Sub
End If
'check for a Tel Ext'
If Trim(Me.TextBox2.Value) = "" Then
Me.TextBox2.SetFocus
MsgBox "Please complete Telephone extension on the form"
Exit Sub
End If
'check for a section'
If Trim(Me.Textbox3.Value) = "" Then
Me.Textbox3.SetFocus
MsgBox "Please complete your section on the form"
Exit Sub
End If
'check for a suggestion'
If Trim(Me.Textbox4.Value) = "" Then
Me.Textbox4.SetFocus
MsgBox "Please enter your suggestion or question"
Exit Sub
End If
'copy the data to the New'
ws.Cells(iRow, 1).Value = Date
ws.Cells(iRow, 2).Value = Me.TextBox1.Value
ws.Cells(iRow, 3).Value = Me.TextBox2.Value
ws.Cells(iRow, 4).Value = Me.Textbox3.Value
ws.Cells(iRow, 5).Value = Me.Textbox4.Value
MsgBox "Your suggestion has been sent - Please check the suggestion or question board for replies to your idea", vbOKOnly + vbInformation, ""
'clear all the data from the Add form'
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.Textbox3.Value = ""
Me.Textbox4.Value = ""
'sets focus on the first text box'
Me.TextBox1.SetFocus
ThisWorkbook.Save
'Email to sender
'Email is sent to admin when send button is pressed"
Const olMailItem = 0
Const olFolderOutbox = 4
Email_Subject = "A suggestion has been submitted via the suggestion portal"
Email_Send_From = ""
Email_Send_To = "test@test.com"
Email_Cc = ""
Email_Bcc = ""
Email_Body = "A suggestion or question has been submitted "
On Error GoTo debugs
Set olApp = CreateObject("Outlook.Application")
olApp.Session.GetDefaultFolder olFolderOutbox
With olApp.CreateItem(olMailItem)
.Subject = Email_Subject
.To = Email_Send_To
.cc = Email_Cc
.BCC = Email_Bcc
.Body = Email_Body
.Send
End With
debugs:
If Err <> 0 Then
MsgBox "Run-time error '" & Err.Number & "':" _
& vbCrLf & vbCrLf & Err.Description
End If
End Sub