best1
02-22-2007, 07:20 AM
guys - having real struggles getting vba to attach pdf file from file path indicated in a txtBox on a userform
if you have any ideas please let me know - it's driving me nuts!!
heres relevant code:
On Error GoTo cleanup
For Each cell In Sheets("Sheet1").Columns("B").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And LCase(cell.Offset(0, 1).Value) = "yes" Then
Set OutMail = OutApp.CreateItem(0)
Dim attach As String
attach = txtAttach1.Value
On Error Resume Next
With OutMail
.To = cell.Value
.Cc = txtCc.Value
.Bcc = txtBcc.Value
.Subject = txtSubject.Value
.Body = "Dear " & cell.Offset(0, -1).Value & vbNewLine & vbNewLine & txtBodyText.Value
.Attachments.Add attach & "\*.pdf"
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
End If
Next cell
Any help would be great!
thanks!
best1
if you have any ideas please let me know - it's driving me nuts!!
heres relevant code:
On Error GoTo cleanup
For Each cell In Sheets("Sheet1").Columns("B").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And LCase(cell.Offset(0, 1).Value) = "yes" Then
Set OutMail = OutApp.CreateItem(0)
Dim attach As String
attach = txtAttach1.Value
On Error Resume Next
With OutMail
.To = cell.Value
.Cc = txtCc.Value
.Bcc = txtBcc.Value
.Subject = txtSubject.Value
.Body = "Dear " & cell.Offset(0, -1).Value & vbNewLine & vbNewLine & txtBodyText.Value
.Attachments.Add attach & "\*.pdf"
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
End If
Next cell
Any help would be great!
thanks!
best1