Sign in to follow this  
Followers 0
Diana (Cda)

Eliminating tabs with StringRegExpReplace ...

3 posts in this topic

Hi!

I have this script which is working quite well except for the string replace part:

$SheetName = InputBox("Please enter the tab sheet's name to hyperlink to (retrieve later via the clipboard).","XL Sheet Name ...",""," ","450","125","700","150")
    ;---------------------------------------------------------------------------------------------------------------------------
    If @error Then
        ;-------------
        $Timeout = "2"     ; Timeout in these number of seconds.
        ;-------------
        MsgBox(16,"Error Message         [Times out in " & $Timeout & "seconds.]","No sheet name given ...", $Timeout)
    Else
        $SheetLinkingFormula = '=HYPERLINK("#"&CELL("address",''' & $SheetName & '''!A4),">>Go To>>")'
        ClipPut(StringRegExpReplace($SheetLinkingFormula, "{tab}", ""))
    EndIf

As I said, everything but the string replace part works. I sometimes am copying directly from Microsoft Excel which adds tabs in the copied text. Would like the clipboard output to be free of the tabs that are pasted into the user input in the box. It's a pain to have to be manually removing them all the time <g>.

Thanks. >_<

Share this post


Link to post
Share on other sites



You can use it like this, StringRegExpReplace() should be used to match and replace a string content using a specific compound pattern:

ClipPut(StringReplace($SheetLinkingFormula, @TAB, ""))

If you insist to use StringRegExpReplace(), the metacharacters to match a tab character are '\t', '\x09' or the @TAB macro.

Share this post


Link to post
Share on other sites

You can use it like this, StringRegExpReplace() should be used to match and replace a string content using a specific compound pattern:

ClipPut(StringReplace($SheetLinkingFormula, @TAB, ""))

If you insist to use StringRegExpReplace(), the metacharacters to match a tab character are '\t', '\x09' or the @TAB macro.

Thanks and thanks for the info re the tab character.

This works really well and is making upgrading a spreadsheet into something that can be navigated easily much simpler than it was, esp. now that I don't have to delete the tabs by hand. Copy/paste and then retrieve for clipboard ... much better.

Cheers. >_<

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0