Posts by don22

    I couldn't find much out there for information on the serviceids for linked data types so I thought I would post this. These are the serviceid's for the Excel linked data types. I created it as an enum so you reference it ServiceID.xxxxx. This way when you type serviceid with a period folowing it, it will display a list of the ids for you to select.


    To use linked data types in VBA you would use the following statement:


    Range.ConvertToLinkedDataType ServiceID:=268435456, LanguageCulture:="en-US".


    To see what each linked data type provides please see this article by Microsoft.


    As of this writing I believe the only LanguageCulture supported is "en-us".


    This list is current as of 5/14/21. As other linked data types are added I will try to keep this updated.

    I used code that was supplied by Cory from this thread mouse-wheel-scroll-userform. I adapted it for 64 bit use. It partially works. It will scroll up but not down and it scrolls up for both up and down wheel movement. Here is the code.



    Code
    Sub UnhookFormScroll()
    
        If mbHook Then
            UnhookWindowsHookEx mLngMouseHook
            mLngMouseHook = 0
            mFormHwnd = 0
            mbHook = False
        End If
        
    End Sub


    Anyone see what is wrong?


    Thanks

    Hi Pike,


    Thanks for posting. It is almost what I am looking for. A few issues with


    Code
     ^(http|ftp|https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$


    I used https://regex101.com/ to validate the expression and found the following issues

    1. Allows anything to be entered for TLD
    2. Does not work for ftp
    3. Does not work for the URL to this post - https://www.ozgrid.com/forum/index.php?thread/1229139-regex-expression-to-validate-urls-and-email-addresses/&postID=1245552#post1245552
    4. More than 2 forward slashes (//) following the :
      • http:///www.abc.com
      • http:///////www.abc.com
    5. Beginning address with one or more forward slashes (/)
      • /www.abc.com
    6. ://www.abc.com

    Getting closer. I changed it to the following and now it works for all of the above except # 6.


    Code
    ^((http|ftp|https)?:\/\/)?([a-z|0-9])([\da-z\/\.-]+)\.(com|edu|org|gov)([\/\w \?\&\=\#\.-]*)*\/?$

    I turned on the flag for testing case insensitivity. In VBA as you would add ".ignorecase = true" to your code.


    Just need to figure out how to handle # 6.


    Added bonus is to allow IP addresses to be entered instead of "www.abc.com". Not needed but probably an interesting exercise as you would have to test for valid ranges. IP addresses are entered as you would normally express them but I believe that IPV6 addresses need to be enclosed in brackets "[]".

    Thanks again. A little more than I was looking for but good. I'll still come up with a Regex that will validate that a URL contains a valid (optional) Scheme (http:, https:, ftp:, ...) and a valid TLD. When i have it I will share..

    Thanks for the reply.


    While this will validate if an email address is properly formatted it does not validate that the Top Level Domain (TLD) or extension is valid. I modified the pattern to the following.


    Code
    ^[\w-\.][email protected]([\w-]+\.)+(com|edu|org|gov)$


    This will not only validate that the email address is properly formatted but that it contains a valid TLD. The TLD list can be modified to meet your needs.

    I am looking for routines to validate URLs and email addresses. Searching the web 99% of the answers involve using regular expressions.I know what regex are but am not familiar with structuring the expressions. The examples I have found don't take into account the fact that certain portions of the URL must be specific values. For example the beginning part of a URL, if present, must be HTTP, HTTPS, FTP, etc. Also the extension part of the domain name must be com, edu, org, etc.


    Valid examples:


    http://www.somedomain.com

    http://www.somedomain.com/something1/something2/...



    Invalid examples:


    htttp://www.somedomain.com

    http://www.somedomain.comm


    The filters I have found would say the invalid examples are ok. Does anyone have regex expressions that take the ICANN (I beleive it is this org) rules for URLs and email addresses into account?


    Thanks

    Don

    I running this at work on a 12 year old PC running Windows 7 and a not up to date office version. I’ll have to try it at home which has current hardware and software to see what the timings are.


    Thanks for the assistance.

    Typo in the code section in the original post. Corrected.


    Searching I found code to spell check a text box on a userform. I created the following function.

    It works fine except that it is very slow. With everything spelled correctly a text box with 34 words takes 27 seconds to run. One with 11 words takes 10 seconds. It is the Application.CheckSpelling that is taking a long time. Anyone have any suggestions on speeding this up?


    Thanks

    Don

    I have a class module that is used to send emails via Outlook from Excel. I would like to present the user a list of email accounts to send from. I know how to get the number of accounts and the email address from Outlook. Since class modules are supposed to be self contained how can I present this list to a user from the class module?


    Thanks

    Don