Hi all
I am currently running the below script to send a spreadsheet to a designated email address within a ss, only issue is I have no idea what I am doing!
How do I get the script to pick up the changing email address which will always be in G45 on the active worksheet.
Sub Understood()
'Working in 97-2010
Dim wb As Workbook
Dim I As Long
Set wb = ActiveWorkbook
If Val(Application.Version) >= 12 Then
If wb.FileFormat = 51 And wb.HasVBProject = True Then
MsgBox "There is VBA code in this xlsx file, there will" & vbNewLine & _
"be no VBA code in the file you send. Save the" & vbNewLine & _
"file first as xlsm and then try the macro again.", vbInformation
Exit Sub
End If
End If
On Error Resume Next
For I = 1 To 3
wb.SendMail ActiveWorkbook.Sheets("Sheet1").Range("G45").Value, _
"Subject"
If Err.Number = 0 Then Exit For
Next I
On Error GoTo 0
End Sub
I am currently running the below script to send a spreadsheet to a designated email address within a ss, only issue is I have no idea what I am doing!
How do I get the script to pick up the changing email address which will always be in G45 on the active worksheet.
Sub Understood()
'Working in 97-2010
Dim wb As Workbook
Dim I As Long
Set wb = ActiveWorkbook
If Val(Application.Version) >= 12 Then
If wb.FileFormat = 51 And wb.HasVBProject = True Then
MsgBox "There is VBA code in this xlsx file, there will" & vbNewLine & _
"be no VBA code in the file you send. Save the" & vbNewLine & _
"file first as xlsm and then try the macro again.", vbInformation
Exit Sub
End If
End If
On Error Resume Next
For I = 1 To 3
wb.SendMail ActiveWorkbook.Sheets("Sheet1").Range("G45").Value, _
"Subject"
If Err.Number = 0 Then Exit For
Next I
On Error GoTo 0
End Sub