Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 194
Default HELP! Macro stuck-"Invalid Object"

I walked this through the recorder yesterday using two documents and it
worked fine. I put it into a major macro routine and made some minor
changes - and now it hangs! But it hangs where yesterday it worked fine!

Workbooks.Open Filename:="C:\NWACCESS\DATA\Sent Updates\Warning.xls"
Cells.Select
Selection.Copy
With wb3.Sheets(3)
Cells.Select
ActiveSheet.Paste
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
End With
Application.DisplayAlerts = False
Workbook.Activate Filename:="C:\NWACCESS\DATA\Sent

Updates\Warning.xls"
Workbook.Close
Application.DisplayAlerts = True

The changes I made were to change the target workbook to wb3, which was

declared at the beginning and has been used all throughout this routine -
and that isn't the problem. Somehow, I can't call back the first workbook
("Warning.xls") to close it. It's hung up saying "Invalid Object". I did
have Workbooks.Close Filename:=etc, but it didn't go, so I tried what's in
there now. It doesn't work either.

Any help?

Ed


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default HELP! Macro stuck-"Invalid Object"

Ed,

Try:
Workbooks("Warning.xls").Activate
ActiveWorkbook.Close

Or better still:
Workbooks("Warning.xls").Close
(there's no need to activate a workbook before closing it)

HTH
Henry


"Ed" wrote in message
...
I walked this through the recorder yesterday using two documents and it
worked fine. I put it into a major macro routine and made some minor
changes - and now it hangs! But it hangs where yesterday it worked fine!

Workbooks.Open Filename:="C:\NWACCESS\DATA\Sent Updates\Warning.xls"
Cells.Select
Selection.Copy
With wb3.Sheets(3)
Cells.Select
ActiveSheet.Paste
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
End With
Application.DisplayAlerts = False
Workbook.Activate Filename:="C:\NWACCESS\DATA\Sent

Updates\Warning.xls"
Workbook.Close
Application.DisplayAlerts = True

The changes I made were to change the target workbook to wb3, which

was
declared at the beginning and has been used all throughout this routine -
and that isn't the problem. Somehow, I can't call back the first workbook
("Warning.xls") to close it. It's hung up saying "Invalid Object". I did
have Workbooks.Close Filename:=etc, but it didn't go, so I tried what's in
there now. It doesn't work either.

Any help?

Ed




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
why do i "sometimes" need to "edit chart object" before "source da Flirty and Blonde Charts and Charting in Excel 1 February 2nd 10 02:07 PM
Macro to Create New Worksheet and Reference Cell in Old Worksheet As Tab Name - "Object Required" Error [email protected] Excel Discussion (Misc queries) 4 September 25th 06 01:35 PM
How do I remove a flash object "stuck on" my spreadsheet? SlowLearner Excel Discussion (Misc queries) 1 September 15th 06 11:03 PM
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" Dennis Excel Discussion (Misc queries) 0 July 17th 06 02:38 PM
How do I "unassign" a deleted Macro from an object in Excel? Sntee Excel Discussion (Misc queries) 2 February 1st 06 04:34 PM


All times are GMT +1. The time now is 08:57 AM.

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"