Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I seem to have a strange problem. Every 2nd time I run my Macro, my range is nothing (thereby causing an error). If I just re-run it, it works fine. Any suggestions would be great. Below is part of my code. The macro turns a range into an htm file and inserts it into an email. Thanks, WB1.Sheets("Template").Activate Dim rngh As Range Dim OutApp As Object Dim OutMail As Object With Application .EnableEvents = False .ScreenUpdating = False End With On Error Resume Next 'Only the visible cells in the selection Set rngh = Sheets("Template").Range("A5:f26").SpecialCells(xl CellTypeVisible) On Error GoTo 0 If rngh Is Nothing Then MsgBox "The selection is not a range or the sheet is protected" & _ vbNewLine & "please correct and try again.", vbOKOnly Exit Sub End If Set OutApp = CreateObject("Outlook.Application") OutApp.Session.Logon Set OutMail = OutApp.CreateItem(0) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
run time error 1004 general odbc error excel 2003 vba | Excel Programming | |||
Counting instances of found text (Excel error? Or user error?) | Excel Worksheet Functions | |||
Error Handling - On Error GoTo doesn't trap error successfully | Excel Programming | |||
Automation Error, Unknown Error. Error value - 440 | Excel Programming |