+ Reply to Thread
Results 1 to 2 of 2

Problem executing a macro from different workbook where it is

  1. #1
    Sergio Calleja
    Guest

    Problem executing a macro from 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. #2
    Bob Phillips
    Guest

    Re: Problem executing a macro from different workbook where it is

    see the response in .programming

    --

    HTH

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


    "Sergio Calleja" <sergio.calleja@gmail.com> wrote in message
    news:3d0ab96e.0501170303.7f620770@posting.google.com...
    > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1