Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Run Time error 1004 Paste Method of Worksheet Class Failed

Every time I run the following code I recieve the error "Run Time error
1004 Paste Method of Worksheet Class Failed". Does anyone have any idea
why? It has worked for months and now it will not. HELP!!!!

Private Sub Workbook_Open()
Selection.Font.Bold = True
ActiveCell.FormulaR1C1 = "American Red Ball International"
Range("A2").Select
ActiveCell.FormulaR1C1 = "Monthly Agent Bookings - by agent"
Range("A5").Select
ActiveCell.FormulaR1C1 = "Booking"
Range("A6").Select
ActiveCell.FormulaR1C1 = "Agent No."
Range("C5").Select
ActiveCell.FormulaR1C1 = "No. of"
Range("C6").Select
ActiveCell.FormulaR1C1 = "Registrations"
Rows("2:6").Select
Selection.Font.Bold = True
Range("A8:C8").Select
ActiveSheet.Paste
Rows("8:8").Select
Selection.Delete Shift:=xlUp
Cells.Select
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
ActiveWorkbook.SaveAs ("\\Gateway1\E\Shared_Folders\Agent
Bookings\AgentBookings")
Cells.Select
Selection.Copy
Workbooks.Add
Cells.Select
Cells.PasteSpecial xlPasteAll
Range("A1").Select
Windows("AgentBookings.xls").Activate
ActiveWorkbook.Close False

End Sub

Thanks in advance for any assistance!
Regards,
K


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Run Time error 1004 Paste Method of Worksheet Class Failed

It will probably work again the next time you have data on your clipboard.

You are pasting without copying anything first.


"Ken Nunn" wrote:

Every time I run the following code I recieve the error "Run Time error
1004 Paste Method of Worksheet Class Failed". Does anyone have any idea
why? It has worked for months and now it will not. HELP!!!!

Private Sub Workbook_Open()
Selection.Font.Bold = True
ActiveCell.FormulaR1C1 = "American Red Ball International"
Range("A2").Select
ActiveCell.FormulaR1C1 = "Monthly Agent Bookings - by agent"
Range("A5").Select
ActiveCell.FormulaR1C1 = "Booking"
Range("A6").Select
ActiveCell.FormulaR1C1 = "Agent No."
Range("C5").Select
ActiveCell.FormulaR1C1 = "No. of"
Range("C6").Select
ActiveCell.FormulaR1C1 = "Registrations"
Rows("2:6").Select
Selection.Font.Bold = True
Range("A8:C8").Select
ActiveSheet.Paste
Rows("8:8").Select
Selection.Delete Shift:=xlUp
Cells.Select
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
ActiveWorkbook.SaveAs ("\\Gateway1\E\Shared_Folders\Agent
Bookings\AgentBookings")
Cells.Select
Selection.Copy
Workbooks.Add
Cells.Select
Cells.PasteSpecial xlPasteAll
Range("A1").Select
Windows("AgentBookings.xls").Activate
ActiveWorkbook.Close False

End Sub

Thanks in advance for any assistance!
Regards,
K


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Run Time error 1004 Paste Method of Worksheet Class Failed

This spreadsheet is fed from a database which copies data to the
clipboard and then into the spreadsheet. It fails on the
"ActiveSheet.Paste" every time however.



*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Run Time error 1004 Paste Method of Worksheet Class Failed

Hi Ken,

The line

ActiveSheet.Paste

looks fishy, as it does not have a preceding Copy, so I guess it will try to
paste whatever is on the clipboard when you open the file. Delete that line.

HTH
Anders Silven

"Ken Nunn" skrev i meddelandet
...
Every time I run the following code I recieve the error "Run Time error
1004 Paste Method of Worksheet Class Failed". Does anyone have any idea
why? It has worked for months and now it will not. HELP!!!!

Private Sub Workbook_Open()
Selection.Font.Bold = True
ActiveCell.FormulaR1C1 = "American Red Ball International"
Range("A2").Select
ActiveCell.FormulaR1C1 = "Monthly Agent Bookings - by agent"
Range("A5").Select
ActiveCell.FormulaR1C1 = "Booking"
Range("A6").Select
ActiveCell.FormulaR1C1 = "Agent No."
Range("C5").Select
ActiveCell.FormulaR1C1 = "No. of"
Range("C6").Select
ActiveCell.FormulaR1C1 = "Registrations"
Rows("2:6").Select
Selection.Font.Bold = True
Range("A8:C8").Select
ActiveSheet.Paste
Rows("8:8").Select
Selection.Delete Shift:=xlUp
Cells.Select
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
ActiveWorkbook.SaveAs ("\\Gateway1\E\Shared_Folders\Agent
Bookings\AgentBookings")
Cells.Select
Selection.Copy
Workbooks.Add
Cells.Select
Cells.PasteSpecial xlPasteAll
Range("A1").Select
Windows("AgentBookings.xls").Activate
ActiveWorkbook.Close False

End Sub

Thanks in advance for any assistance!
Regards,
K


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!


Reply
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
Run-time error '1004': AutoFill method of Range class failed murkaboris Excel Discussion (Misc queries) 10 April 16th 09 09:06 PM
Run-time error '1004': AutoFill method of Range class failed murkaboris Excel Discussion (Misc queries) 3 April 14th 09 10:35 PM
Error 1004 Copy method of worksheet class failed Ayo Excel Discussion (Misc queries) 3 March 28th 08 02:05 PM
Run-Time error '1004' : Select method of Range class failed [email protected] Excel Discussion (Misc queries) 3 March 9th 07 01:36 PM
Run-time error '1004' PasteSpecial Method of Range Class Failed Kevin G[_2_] Excel Programming 1 February 3rd 04 05:01 AM


All times are GMT +1. The time now is 10:52 PM.

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

About Us

"It's about Microsoft Excel"