Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Trapping Excel Macros

Status
Not open for further replies.

haedyr

Programmer
May 25, 2005
18
US
I have put in an error trap in my code so that if there is an error, that it would skip all code and move to the designated marker. It's not working for me at all. Can somebody please help me figure out what is wrong? Here's the code:

On Error GoTo skip_download
If labels(indx).email <> "" Then
Workbooks.Open Filename:=Download_Path(indx), ReadOnly:=True
ActiveWorkbook.SendMail Recipients:=labels(indx).email, Subject:="Rhapsody Download Details " & current_timeframe & " " & labels(indx).label_name
ActiveWorkbook.Close savechanges:=False
End If
skip_download:
Next indx

Thank you very much!
 
On Error GoTo skip_download
If labels(indx).email <> "" Then
Workbooks.Open Filename:=Download_Path(indx), ReadOnly:=True
ActiveWorkbook.SendMail Recipients:=labels(indx).email, Subject:="Rhapsody Download Details " & current_timeframe & " " & labels(indx).label_name
ActiveWorkbook.Close savechanges:=False
End If
Resume_Next_indx:
Next indx
...
Exit Sub
skip_download:
Resume Resume_Next_indx
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I actually have another problem. I'm emailing these.txt files using the Macro. I'm using Excel 2000 and Eudora 6.2. When the person receives the .txt files, they aren't able to import them into excel like they used to when I didn't use the macro to send the files.
I was thinking that the reason the files aren't importing correctly is because in my macro I say Open the workbook and then email it. Is there a way I can use the excel macro to send a .txt file without actually opening it? Or, better yet, is there a way that I can import the .txt file into excel and have it formatted before I email it? I would prefer either way.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top