LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default Code fails if ran more than once

Hello all,

I have pasted some of my code below. It runs fine the first time but if the
user runs it again it hangs up on the .SaveAs line. If anyone can give me
any insight as to why this is happening and/or suggestions to fix it I would
be most gratful.

Christy ;)


With newbook.Sheets(1)
.Cells(1).PasteSpecial xlPasteValues, , False, False
.Columns("A:F").AutoFit
.Range("A2,a19,a36,a53,a70,a87,a104").Select
With Selection
.NumberFormat = "m/d/yyyy"
End With
.Range("a1").Select
Application.CutCopyMode = False
End With

With newbook
.SaveAs FileName:=OfficeName, FileFormat:=xlNormal

'Handle the error if user clicks "NO" at Outlook security pop-up
On Error Resume Next
.SendMail MyArr, Sheet1.Range("a99").Value
On Error GoTo 0

.Close True
End With

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filtering Fails RussellT Excel Discussion (Misc queries) 1 October 31st 09 12:17 AM
Code fails when sheet is protected Tail Wind Excel Discussion (Misc queries) 3 September 4th 07 03:23 PM
Named Range Fails in VBA Code Dean Hinson[_3_] Excel Programming 3 January 24th 05 03:48 PM
solver.xla fails g.Lakshmi Excel Programming 1 August 23rd 04 11:57 AM
Logitech's newest mouse scroll fails in VBE code pane Robin Hammond Excel Programming 0 July 11th 03 02:29 PM


All times are GMT +1. The time now is 12:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"