Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro names not consistent?


Hi,

I have a subroutine written, to be run on various different machines.
This is to be run automatically as part of an overnight procedure, so
have it being called from a VBscript file. Of the form


Code
-------------------
Set xlObj = CreateObject("Excel.application")
xlObj.Workbooks.Open "c:\trinity\exchange.xls"
xlObj.Run "ExchangePriceImport"
xlObj.ActiveWorkbook.Saved = True
xlObj.ActiveWindow.Close
xlObj.Qui
-------------------


However, on certain machines this code fails, saying the macro canno
be found.
On looking in the workbook under toolsmacros, the name seems to be o
the form

exchange.xls!sheet1.ExchangePriceImport

However on other machines, opening the file shows the macro in the lis
as ExchangePriceImport only.

What is casuing this, and how can I stop the name being altered? a
this is stopping processes runing on certain systems.

Excel version is 2000 and they're all running the same service pack.

Thank

--
alex99
-----------------------------------------------------------------------
alex999's Profile: http://www.excelforum.com/member.php...fo&userid=1497
View this thread: http://www.excelforum.com/showthread.php?threadid=26602

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default macro names not consistent?

there is a significant difference between placing the macro in a sheet's
code module or placing it in a normal code module.

imho: code that is NOT strictly related to events or controls should never
be placed in an object module.

SO I suggest that you check your files, and for those files where the
macro shows up as sheet1.MyMacro you'll have to move the procedure to
a normal module.

moreover...
if the code in all those files is the same...
adapt your code to work independent of the specific files
(either make it work with a workbook variable or with the activeworkbook)
remove the macro's from your workbooks and include the adapted procedure
in your vbs script/file.

moreover...
if all your users use the same file anyway...
(exchange rates suggest a readonly scenario)
....
why not store it in 1 networklocation, mark it as readonly,
and have the users share it?

(be sure to remove the readonly attribute in your update script :)





keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


alex999 wrote:


Hi,

I have a subroutine written, to be run on various different machines.
This is to be run automatically as part of an overnight procedure, so I
have it being called from a VBscript file. Of the form


Code:
--------------------
Set xlObj = CreateObject("Excel.application")
xlObj.Workbooks.Open "c:\trinity\exchange.xls"
xlObj.Run "ExchangePriceImport"
xlObj.ActiveWorkbook.Saved = True
xlObj.ActiveWindow.Close
xlObj.Quit
--------------------


However, on certain machines this code fails, saying the macro cannot
be found.
On looking in the workbook under toolsmacros, the name seems to be of
the form

exchange.xls!sheet1.ExchangePriceImport

However on other machines, opening the file shows the macro in the list
as ExchangePriceImport only.

What is casuing this, and how can I stop the name being altered? as
this is stopping processes runing on certain systems.

Excel version is 2000 and they're all running the same service pack.

Thanks



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
Dates not consistent Nev Wood Excel Discussion (Misc queries) 3 September 30th 08 01:43 PM
Sub-Totals not consistent Tia Excel Discussion (Misc queries) 0 March 12th 07 08:53 PM
Keep consistent between two worksheets Hank Excel Discussion (Misc queries) 1 June 29th 06 04:04 AM
Consistent Formatting in Each Worksheet nicolebelle Excel Discussion (Misc queries) 3 January 27th 06 04:04 PM
Changing consistent Cells fwday Excel Programming 1 October 22nd 03 05:38 PM


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