Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default moved macros to new book, now not working

I thought I posted this problem last night, but I can't find it anywhere. My
apologies if I've posted it twice.

I moved some macros to a new workbook, so they could be shared amongst
multiple workbooks. In order to run the code in the new location, I changed
the worksheet_activate sub in the originating sheet as follows:

from Call Macro1("Parm1")
to Application.Run "'_Workbook2.xls'!Macro1(""Parm1"")"

Now some of the code doesn't work. For example:

With Worksheets("Sheet1")
.Columns("A:I").ClearContents ' does nothing
.Cells(10, 3) = "line 1" ' works
End With

Any suggestions would be greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default moved macros to new book, now not working

See note BELOW
--
HTH,

Barb Reinhardt



"lallen" wrote:

I thought I posted this problem last night, but I can't find it anywhere. My
apologies if I've posted it twice.

I moved some macros to a new workbook, so they could be shared amongst
multiple workbooks. In order to run the code in the new location, I changed
the worksheet_activate sub in the originating sheet as follows:

from Call Macro1("Parm1")
to Application.Run "'_Workbook2.xls'!Macro1(""Parm1"")"

Now some of the code doesn't work. For example:


' What is the ACTIVEBOOK here.
'I'm betting it's not what you think it is.

With Worksheets("Sheet1")
.Columns("A:I").ClearContents ' does nothing
.Cells(10, 3) = "line 1" ' works
End With

Any suggestions would be greatly appreciated.

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
moved code to new book - some doesn't work now lallen Excel Programming 4 April 28th 10 02:30 AM
Moved file, changed path, macros don't work donbowyer Excel Programming 3 May 22nd 06 08:27 AM
Dates change to prior year when page moved to new book David_UCSF Excel Discussion (Misc queries) 1 November 22nd 05 06:37 PM
Open book, check for macros, close book Robin Hammond[_2_] Excel Programming 5 March 31st 05 06:09 PM
Maintaining a hyperlink to moved data within the work book Kev Nurse Excel Discussion (Misc queries) 1 January 28th 05 01:22 AM


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