+ Reply to Thread
Results 1 to 15 of 15

Macro to Superscript specific Text with variable numbers

  1. #1
    Registered User
    Join Date
    02-06-2013
    Location
    Mexico
    MS-Off Ver
    MS Office 2016
    Posts
    95

    Thumbs up Macro to Superscript specific Text with variable numbers

    I want to create a macro that change to Superscript in all PowerPoint textboxes the text strings that contains this form: #Numbers

    For example:
    #1
    #12
    #123
    #1234

    All above needs to be superscript including the hashtag.

    澳oes anyone knows how can I do it?

    thanks

    Sample Presentation file attached
    Attached Files Attached Files
    Last edited by pacosalasv; 03-30-2022 at 10:20 AM. Reason: Include an attachment

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: Macro to Superscript specific Text with variable numbers

    Please attach a sample PPT file where you would want to do this. See yellow banner at the top of the page.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    02-06-2013
    Location
    Mexico
    MS-Off Ver
    MS Office 2016
    Posts
    95

    Re: Macro to Superscript specific Text with variable numbers

    Quote Originally Posted by 6StringJazzer View Post
    Please attach a sample PPT file where you would want to do this. See yellow banner at the top of the page.
    Thanks for reminder, Presentation with two slides attached.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: Macro to Superscript specific Text with variable numbers

    This worked successfully in your test file.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-06-2013
    Location
    Mexico
    MS-Off Ver
    MS Office 2016
    Posts
    95

    Re: Macro to Superscript specific Text with variable numbers

    Quote Originally Posted by 6StringJazzer View Post
    This worked successfully in your test file.

    Please Login or Register  to view this content.
    Thanks! it works fine at sample file, but how can i handle when the text boxes doesn't have #12 i mean, slides without #ID ??? How can i skip and continue with next shape / slide respectively?

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: Macro to Superscript specific Text with variable numbers

    It will do that automatically.

  7. #7
    Registered User
    Join Date
    02-06-2013
    Location
    Mexico
    MS-Off Ver
    MS Office 2016
    Posts
    95

    Re: Macro to Superscript specific Text with variable numbers

    Quote Originally Posted by 6StringJazzer View Post
    It will do that automatically.
    I tried the macro in other PowerPoint File and i got this error message:

    Run-time error '-2147024809 (80070057)':

    The specified value is out of range.


    I cant share the file, due copyrights.

    Do you know how can i handle this error and continue executing the routine for the rest of the presentation?

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: Macro to Superscript specific Text with variable numbers

    What line of code caused the error? I can't fix it unless I can reproduce it. I need to understand what was in the file that caused it, even if you can't give me a copy.

  9. #9
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: Macro to Superscript specific Text with variable numbers

    I tried running this in a modified file that had:

    Textbox with no ID numbers
    Textbox with "#" but no digits

    and no error occurred.

    I cannot tell you how to handle the error unless I know what is causing it.

  10. #10
    Registered User
    Join Date
    02-06-2013
    Location
    Mexico
    MS-Off Ver
    MS Office 2016
    Posts
    95

    Re: Macro to Superscript specific Text with variable numbers

    Attached you will find a presentation that causes the error message.

    Apparently if if there is a superscript already, it fails...
    Attached Files Attached Files

  11. #11
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: Macro to Superscript specific Text with variable numbers

    Quote Originally Posted by pacosalasv View Post
    Apparently if if there is a superscript already, it fails...
    No, that is not the problem. If there is a superscript already, nothing happens.

    The problem is that the code loops through all Shapes, because a TextBox is a Shape. However, if there are other types of Shapes present, they may not have text and you can't refer to those properties. That didn't crop up in the first file, but in the second file you have a Picture on Slide 1.

    Here is a correction to the code that works on the second file:
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    02-06-2013
    Location
    Mexico
    MS-Off Ver
    MS Office 2016
    Posts
    95

    Re: Macro to Superscript specific Text with variable numbers

    Quote Originally Posted by 6StringJazzer View Post
    No, that is not the problem. If there is a superscript already, nothing happens.

    The problem is that the code loops through all Shapes, because a TextBox is a Shape. However, if there are other types of Shapes present, they may not have text and you can't refer to those properties. That didn't crop up in the first file, but in the second file you have a Picture on Slide 1.

    Here is a correction to the code that works on the second file:
    Please Login or Register  to view this content.
    Its amazing, thanks a lot. works so good!!!

    Just one more question, if i want the # (Hashtag) also to go as superscript. How can i do it?

  13. #13
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: Macro to Superscript specific Text with variable numbers

    This revision will also superscript the # sign

    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    02-06-2013
    Location
    Mexico
    MS-Off Ver
    MS Office 2016
    Posts
    95

    Re: Macro to Superscript specific Text with variable numbers

    Quote Originally Posted by 6StringJazzer View Post
    This revision will also superscript the # sign

    Please Login or Register  to view this content.
    Its simple and magnificent, the best support possible.

    Thanks a lot for your excellent support and attention.

  15. #15
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: Macro to Superscript specific Text with variable numbers

    You're welcome!

    If a member helped you solve your problem, consider adding to their reputation by clicking on the star icon addreputationiconsmall.jpg below their name.

+ 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. Replies: 9
    Last Post: 07-04-2020, 07:39 PM
  2. [SOLVED] Macro to replace numbers with specific text value
    By Shayk in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 11-05-2016, 03:01 AM
  3. Superscript numbers in selected cells
    By Cobra66 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-21-2015, 03:39 PM
  4. Superscript ordinal numbers in CreateDate field
    By alexisn in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 04-15-2014, 04:49 AM
  5. Macro to edit variable text in a specific cell
    By westic in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-01-2013, 10:19 AM
  6. Macro required for changing numbers to specific text
    By amolryeolekar in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-18-2013, 01:26 PM
  7. How can I superscript numbers greater than 3?
    By Caseybay in forum Excel General
    Replies: 2
    Last Post: 04-23-2005, 12:06 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