+ Reply to Thread
Results 1 to 3 of 3

Problems calling macros from "ThisWorkbook"

  1. #1
    Registered User
    Join Date
    01-19-2006
    Posts
    2

    Problems calling macros from "ThisWorkbook"

    I am trying to call a macro from a sheet using thisworkbook, however, I don't think it allows this. Therefore as a solution I just recopied the macro that I was using into "thisworkbook". However, the 'Sheets("Charts").ChartObjects("Chart " & r).SeriesCollection(1).XValues = ' command does not seem to be recognized in this object, so now I am unable to autoupdate the charts which was the whole reason for this whole process. Any help in either getting that command to work in "thisworkbook" or allowing me to call a macro from a sheet using "thisworkbook" would be greatly appreciated.

  2. #2
    Registered User
    Join Date
    01-19-2006
    Posts
    2
    No one has any ideas?

  3. #3
    Dave Peterson
    Guest

    Re: Problems calling macros from "ThisWorkbook"

    I had difficulty understanding the question.

    But if the procedure is behind a worksheet, you could use:

    Option Explicit
    Public Sub mySub()
    MsgBox "hi from the sheet"
    End Sub

    And call it via:
    Option Explicit
    Private Sub Workbook_Open()
    Call Sheet1.mySub
    End Sub

    If the procedure is in ThisWorkbook:
    Option Explicit
    Public Sub mySub()
    MsgBox "hi from thisworkbook"
    End Sub

    and called elsewhere (from a sheet or general module):
    Option Explicit
    Sub other_sub()
    Call ThisWorkbook.mySub
    End Sub

    But I think moving general procedures to General modules is the best/safest bet.





    blesbok wrote:
    >
    > No one has any ideas?
    >
    > --
    > blesbok
    > ------------------------------------------------------------------------
    > blesbok's Profile: http://www.excelforum.com/member.php...o&userid=30635
    > View this thread: http://www.excelforum.com/showthread...hreadid=502891


    --

    Dave Peterson

+ 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