+ Reply to Thread
Results 1 to 7 of 7

Playing code after a section

  1. #1
    Registered User
    Join Date
    01-19-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    25

    Playing code after a section

    How do i play some code, after section 2 for example?

  2. #2
    Forum Contributor
    Join Date
    12-19-2012
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: Playing code after a section

    Hi,

    What do you mean by "section 2" ?

    Regards
    Steve

  3. #3
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Playing code after a section

    And what do you mean by 'play some code'?
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  4. #4
    Registered User
    Join Date
    01-19-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Playing code after a section

    In word, you can create 'sections' which can break the page up, microsoft recognises what section you are in, i want to know how i can find this out so i can 'play some code' after i have found out what section i am in.

    OR i just want to do some VBA for every section, BUT section 1, and "play some code" is self explanatory, i want it to play some code in section 2

  5. #5
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Playing code after a section

    It is still far from clear what you want to do - you refer to both "VBA for every section" and "play some code in section 2". Previously, you said you wanted to "play some code, after section 2 for example". Which is it?

    You might think '"play some code" is self explanatory', but in 12 years or so of providing help on forums, this is the first time I've encountered the expression. I suspect you mean you want to run a macro, but you've not said so; for all I know you want to run a macro that can be found in Section 2 or to play a video file or sound file embedded in Section 2 ...

    You can get the selection's Section # with code like:
    MsgBox Selection.Sections(1).Index

  6. #6
    Registered User
    Join Date
    01-19-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Playing code after a section

    That is almost what i wanted, but how do i get the code (just ANY vba, i really don't think it makes a difference what the code is) lets just say

    pictureformat as inline shape

    for each pictureformat in .section(2 to 20)
    with pictureformat
    converttoshape
    .formatpicture.textbox.type = wdTextboxCentered
    end with
    next pictureformat

    end sub

  7. #7
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Playing code after a section

    It really isn't clear what you want to do. If you said what that is instead of using obscure terminology and ambiguous pseudo-code, more progress might be made. It seems you want to:
    1) convert every inline shape in sections 2 onwards to shapes; and
    2) convert the converted shapes to centred textboxes
    The first is possible, but the second is not. You can, however, add a textframe to any shape object.

    In any event, if you have in-line textboxes in that range, it's only their wrap format that needs changing as (despite appearances to the contrary) they're not inline shapes. For example, the following code will change the wrap format and alignment of all in-line textboxes in Sections 2 onwards:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Playing Sound file without pausing code
    By beat in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-17-2013, 05:48 AM
  2. [SOLVED] playing an alert sound at the end of code running
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-07-2012, 11:07 AM
  3. VBA code for playing wav on MAC os
    By matrex in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-20-2011, 11:54 AM
  4. Moving section headings from below section to above section..
    By Fayebaline in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-24-2011, 06:58 AM
  5. Problem with playing sound code
    By EMoe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-05-2005, 08:30 PM

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