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: 16
Default macro in copied workbook fails

Okay, I believe I tracked down my own problem.

This explains the "Run-time error:'13' Type Mismatch" error message
when you click a macro or a function on a menu in Excel 2002 (and I
assume it applies to Excel 2000, SP3 as well).

http://support.microsoft.com/default...b;en-us;821292

The issue I am experiencing is in Excel 2000, SP3 on a corporate PC.
My employer will not upgrade at this time. Ergo, is it possible to
write the following macro in a different way, to avoid the Run-time
error:'13' Type Mismatch when it's original workbook is copied to a new
workbook?

Sub print_schedule()
'
' print_schedule Macro
'
'
Application.ScreenUpdating = False
Application.DisplayAlerts = False

Sheets("Schedule 1").Select
ActiveWorkbook.Names.Add Name:= _
"'Schedule 1'!Print_Area", _
RefersTo:="=" & worksheets("Admin").Range("F95").Value
Application.ActivePrinter = "\\Print01\ARPRN41 on Ne04:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
Collate:=True
Sheets("Personnel").Select

Application.ScreenUpdating = True
Application.DisplayAlerts = True

End Sub

Thanks for any assistance or insight you can offer.

Joseph

wrote:
For more amplification:

A runtime error '13' type mismatch is occuring in my copied workbook.

This portion of the code fails:

ActiveWorkbook.Names.Add Name:= _
"'Schedule 1'!Print_Area", _
RefersTo:="=" & worksheets("Admin").Range("F95").Value

The filename is:

Schedule Manager - Apr 19, 2006 - 1806z.xls

Could the filename be the problem? I've read about filenames causing
runtime errors before. Any thoughts?


Thanks,
Joseph

Chip Pearson wrote:
What do you mean "no longer functions"? Do you get an error
message? What happens when you run the code?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


wrote in message
oups.com...
Here are the conditions:

I have a printing macro in a workbook that works perfectly.
When I
create a copy of the workbook (along with the macro) the macro
in the
newly copied workbook no longer functions. Both workbooks
reside in
the same directory. Any ideas about what may be causing this
behavior?

For clarity, here is the macro (Tom Ogilvy assisted me with
this
earlier in the week):

Sub print_schedule()
'
' print_schedule Macro
'
'
Application.ScreenUpdating = False
Application.DisplayAlerts = False


Sheets("Schedule 1").Select
ActiveWorkbook.Names.Add Name:= _
"'Schedule 1'!Print_Area", _
RefersTo:="=" & worksheets("Admin").Range("F95").Value
Application.ActivePrinter = "\\Print01\ARPRN41 on Ne04:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
Collate:=True
Sheets("Personnel").Select


Application.ScreenUpdating = True
Application.DisplayAlerts = True


End Sub

---------------------

Thanks kindly,
Joseph


 
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
Workbook fails to open - Excel 2003 nc Excel Discussion (Misc queries) 1 February 2nd 06 06:33 PM
Excel fails to open workbook using Automation from VB 6 Lowell Excel Programming 0 September 8th 05 05:33 AM
Programmatically saving a workbook to a ftp location fails Lloyd Excel Programming 0 December 20th 04 09:17 PM
Sheets select method fails when workbook is opened by another workbook Mike Excel Programming 2 June 8th 04 04:17 AM
Why my cell format is not copied when I copied workbook? courtesio99[_28_] Excel Programming 0 January 9th 04 07:03 AM


All times are GMT +1. The time now is 02:01 AM.

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"