Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Macro problem after copying an Excel File

Hello,

Can anyone help please?

I have a file 2009xxx.xls with many macros. I now wish to copy and call it 2010xxx.xls
but the macro's won't run and advise that it needs debugging.
Is there any way to update them without re-recording? I've tried to edit the names but
they don't run.

Kind regards
Peter

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 72
Default Macro problem after copying an Excel File

post the code that causes the debug? do you explicitly use the filename in
any of the macros?

--


Gary Keramidas
Excel 2003


"Peter" wrote in message
...
Hello,

Can anyone help please?

I have a file 2009xxx.xls with many macros. I now wish to copy and call
it 2010xxx.xls but the macro's won't run and advise that it needs
debugging.
Is there any way to update them without re-recording? I've tried to edit
the names but they don't run.

Kind regards
Peter


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Macro problem after copying an Excel File

On 06/03/2010 15:30, Gary Keramidas wrote:
post the code that causes the debug? do you explicitly use the filename
in any of the macros?

Gary,

Here is a portion of the code, the penultimate line is highlighted when the macro runs. I
copied the original file 'Accounting.xls' and renamed it 'Accounts 2010-11.xls'. Perhaps
Excel is not intelligent enough to realise! :


Sub report_VOUCHERS()
'
' report_VOUCHERS Macro
' Macro recorded 08/02/2010 by Peter Rawbone
'

'
Cells.Select
With Selection
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Selection.ClearContents
Selection.ColumnWidth = 8.43
Selection.RowHeight = 12.75
Range("A1").Select
Application.Run "Accounts 2010-11.xls!Vouchers"
Rows("1:1").Select

Any advice greatly appreciated

Peter

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Macro problem after copying an Excel File

Application.Run ("Accounts 2010-11.xls!Vouchers")


Gord Dibben MS Excel MVP

On Sat, 06 Mar 2010 16:59:39 +0000, Peter wrote:

On 06/03/2010 15:30, Gary Keramidas wrote:
post the code that causes the debug? do you explicitly use the filename
in any of the macros?

Gary,

Here is a portion of the code, the penultimate line is highlighted when the macro runs. I
copied the original file 'Accounting.xls' and renamed it 'Accounts 2010-11.xls'. Perhaps
Excel is not intelligent enough to realise! :


Sub report_VOUCHERS()
'
' report_VOUCHERS Macro
' Macro recorded 08/02/2010 by Peter Rawbone
'

'
Cells.Select
With Selection
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Selection.ClearContents
Selection.ColumnWidth = 8.43
Selection.RowHeight = 12.75
Range("A1").Select
Application.Run "Accounts 2010-11.xls!Vouchers"
Rows("1:1").Select

Any advice greatly appreciated

Peter


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Macro problem after copying an Excel File

I'd try:
Application.Run "'Accounts 2010-11.xls'!Vouchers"

I think you'll need the extra apostrophes since the name has those spaces in it.

And you'll have to make sure that this file is open when you start the macro.

Peter wrote:

On 06/03/2010 15:30, Gary Keramidas wrote:
post the code that causes the debug? do you explicitly use the filename
in any of the macros?

Gary,

Here is a portion of the code, the penultimate line is highlighted when the macro runs. I
copied the original file 'Accounting.xls' and renamed it 'Accounts 2010-11.xls'. Perhaps
Excel is not intelligent enough to realise! :

Sub report_VOUCHERS()
'
' report_VOUCHERS Macro
' Macro recorded 08/02/2010 by Peter Rawbone
'

'
Cells.Select
With Selection
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Selection.ClearContents
Selection.ColumnWidth = 8.43
Selection.RowHeight = 12.75
Range("A1").Select
Application.Run "Accounts 2010-11.xls!Vouchers"
Rows("1:1").Select

Any advice greatly appreciated

Peter


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Macro problem after copying an Excel File

My grateful thanks to all who responded so quickly and accurately. The addition of the
extra apostrophes made all the difference. A quick VBA edit and all works as it should.

Easy when you know how!

Enjoy your day

Kind regards

Peter


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
Copying Multiple files in one file Macro - Liz Liz New Users to Excel 2 March 13th 07 02:45 PM
macro for copying file Joseph Excel Discussion (Misc queries) 1 August 24th 05 02:07 PM
problem copying excel wroksheets Paul Townley Excel Discussion (Misc queries) 1 April 6th 05 06:29 PM
Problem Editing Macro in Shared Excel File [email protected] Excel Discussion (Misc queries) 1 March 19th 05 06:43 PM
Problem Editing Macro in Shared Excel File [email protected] Excel Discussion (Misc queries) 0 March 19th 05 06:01 PM


All times are GMT +1. The time now is 08:13 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"