You need to sign in to do that
Don't have an account?
Roy D.
suppress the message box when deleting records
Can somebody help here?
Need to suppress the delete number of records message box.
Dim msg$: msg = "You are about to DELETE: " & CStr(Selection.Rows.Count) & " " & g_objectType & _
" record(s)"
'If (MsgBox(msg, vbApplicationModal + vbOKCancel + vbExclamation + vbDefaultButton1,"-- Ready to Update Salesforce.com --") = vbCancel) Then GoTo done
Thanks,
Roy
I think you can just delete or comment out those two lines
Ron,
I get a invalid range error. I think the spreadsheet loses the focus?
Roy
Ron,
I get the range error when sfdelete calls the next sub (range delete). for the life of me I can't figure out why the error come up.
the code:
Sub sfDelete()
Dim chunk As Range
On Error GoTo wild_error
If Not SessionMe Then GoTo done
If Not set_Ranges Then GoTo done
' entire row selected trim this to region
If (Selection.Rows.Count = 65536) Then Intersect(Selection, g_body).Select
Dim msg$: msg = "You are about to DELETE: " & CStr(Selection.Rows.Count) & " " & g_objectType & _
" record(s)" & vbCrLf
If (MsgBox(msg, vbApplicationModal + vbOKCancel + vbExclamation + vbDefaultButton1, _
"-- Ready to Update Salesforce.com --") = vbCancel) Then GoTo done
Dim row_pointer%: row_pointer = Selection.row ' row where we start to chunk
Do ' build a chunk Range which covers the cells we can update in a batch
Set chunk = Intersect(Selection, ActiveSheet.Rows(row_pointer))
If chunk Is Nothing Then Exit Do
Set chunk = chunk.Resize(maxBatchSize) ' extend the chunk to cover our batchsize
Set chunk = Intersect(Selection, chunk) ' trim the last chunk !
row_pointer = row_pointer + maxBatchSize ' up our pos counter
' Debug.Print "here do the chunk, " & chunk.row & " " & chunk.Rows.Count
' For Each c In chunk
' Debug.Print c.value
' Next c
chunk.Interior.ColorIndex = 36 ' show off...
If Not delete_Range(chunk) Then GoTo done ' do it
chunk.Interior.ColorIndex = 0
Loop Until chunk Is Nothing
GoTo done
wild_error:
sfError "Salesforce: Delete() " & vbCrLf & _
"invalid Range, missing data type, or other error, type is: " & _
g_objectType & vbCrLf & Error()
done:
Application.StatusBar = False
End Sub
Function delete_Range(todo As Range)
Dim idlist() As String
ReDim idlist(todo.Rows.Count - 1)
Dim i, rw: For Each rw In todo.Rows
idlist(i) = objectid(rw.row)
i = i + 1
Next rw
Application.StatusBar = "Delete :" & _
todo.row - Selection.row + 1 & " -> " & _
todo.row - Selection.row + todo.Rows.Count & _
" of " & CStr(Selection.Rows.Count)
Call salesforce.DoDelete(idlist, g_objectType)
If (Not salesforce.Msg_and_Fail_if_APIError) Then GoTo done
' TODO when one fails we don't need to skip all of the rest...
' do it like the create calls?
For Each rw In todo.Rows ' draw results
Intersect(g_ids, ActiveSheet.Rows(rw.row)).value = "deleted"
Next rw
delete_Range = True
done:
End Function