Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problem executin macro from a different workbook where it is

Hi everibody,
I have a macro in a workbook called, for example, WB1.xls. The macro
takes differentes ranges and copy them in another location. ex. :
Public Sub ZeroizaModeloSteve()
Set wbModelo = Application.Workbooks(Mid(cteLibModelo, 2))
Set wsI = wbModelo.Sheets("I")
Set wsT = wbModelo.Sheets("T")
Set wsmodelo = wbModelo.Sheets(cteHojaModelo)
Set wsZeroing = wbModelo.Sheets(cteHojaZeoring)

wsI.Range("F50:IS50").Copy
wsI.Range("F51").PasteSpecial xlPasteValues
end sub
'i have omitted declaration variables and desctruction

ok? so, if i execute the macro in workbook where it is, works
perfectly.
But when i try to execute it from another workbook, with WB1.xls open,
it doesn't work.
I use the follow intruction to do it: Application.Run
"WB1.xls'!Modelo.ZeroizaModeloSteve"

Help me please :_(

Thank you very much

Sergio
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Problem executin macro from a different workbook where it is

Sergio,

As far as I can see from your post, all you need is

Application.Run "WB1.xls!ZeroizaModeloSteve"


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Sergio Calleja" wrote in message
om...
Hi everibody,
I have a macro in a workbook called, for example, WB1.xls. The macro
takes differentes ranges and copy them in another location. ex. :
Public Sub ZeroizaModeloSteve()
Set wbModelo = Application.Workbooks(Mid(cteLibModelo, 2))
Set wsI = wbModelo.Sheets("I")
Set wsT = wbModelo.Sheets("T")
Set wsmodelo = wbModelo.Sheets(cteHojaModelo)
Set wsZeroing = wbModelo.Sheets(cteHojaZeoring)

wsI.Range("F50:IS50").Copy
wsI.Range("F51").PasteSpecial xlPasteValues
end sub
'i have omitted declaration variables and desctruction

ok? so, if i execute the macro in workbook where it is, works
perfectly.
But when i try to execute it from another workbook, with WB1.xls open,
it doesn't work.
I use the follow intruction to do it: Application.Run
"WB1.xls'!Modelo.ZeroizaModeloSteve"

Help me please :_(

Thank you very much

Sergio



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
Problem removing sharing from workbook via Macro BenS Excel Discussion (Misc queries) 3 October 25th 07 11:43 PM
Problem executing a macro from different workbook where it is Sergio Calleja Excel Discussion (Misc queries) 1 January 17th 05 12:38 PM
Problem closing a workbook using a macro Steve Excel Programming 3 September 21st 04 01:03 PM
Problem running macro from add-in (xla-file) in a shared workbook. Klaus Trampedach Excel Programming 0 September 30th 03 03:32 PM


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