+ Reply to Thread
Results 1 to 6 of 6

VBA does not correct the notation of functions and variables that are located in a .xlam

  1. #1
    Registered User
    Join Date
    02-07-2019
    Location
    Switzerland
    MS-Off Ver
    Office 365 Mac
    Posts
    23

    VBA does not correct the notation of functions and variables that are located in a .xlam

    When I am using functions and variables I am used to see that VBA corrects the notation. Then I know, that my coding is recognized by VBA. But VBA doesn't do this for my functions and variables declared in my .xlam. Even after compile there is no correction. The code works as expected, but this confuses me really much.

    Is there anything to specify, that this works properly or do I have to live with this lack ?

    Office 365 on MacOS

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: VBA does not correct the notation of functions and variables that are located in a .xl

    These produce exactly the same result.

    Please Login or Register  to view this content.
    You will not see the above when it executes.

    Please Login or Register  to view this content.
    You will see all the action for the above code although it might just appear as fliker onthe monitor. Direct coding as in the first example shows very little if any updating on the monitor screen. But the Select and Activate method of coding does show the updates on screen step by step.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    02-07-2019
    Location
    Switzerland
    MS-Off Ver
    Office 365 Mac
    Posts
    23

    Re: VBA does not correct the notation of functions and variables that are located in a .xl

    Maybe I did not explain exactly.

    In my .xlam there is following Code:

    Please Login or Register  to view this content.
    But when I use this code and enter normally without capital letters, the notation will be not changed by VBA:

    Please Login or Register  to view this content.
    Normalls VBA would change this to:

    If getDate(myString) = True Then myDate = getDateValue

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: VBA does not correct the notation of functions and variables that are located in a .xl

    Please Login or Register  to view this content.
    Is there more to this that was not posted? This would not produce a result as it is shown here. It needs some more lines of code to determine if 'getdate' is True or False and assign the appropriate value back to 'getdate'. So when your If statement executes, the 'getdate' function is probably returning an empty string or empty value for 'myString' . As for entering capital letters in the function call, it should automatically revert to the same case as the actual function. But UDF should all be in one of the numbered code modules for effedtive use.

  5. #5
    Registered User
    Join Date
    02-07-2019
    Location
    Switzerland
    MS-Off Ver
    Office 365 Mac
    Posts
    23

    Re: VBA does not correct the notation of functions and variables that are located in a .xl

    Sorry again

    As above-mentioned the function executes as expected with precise results.
    It is just the notation when I am writing the code.

    I write in lower case letters:

    If getdate(myString) = True Then myDate = getdatevalue

    and expect that VBA corrects the notation as it is defined in the .XLAM module and VBA does with all other code:

    If getDate(myString) = True Then myDate = getDateValue

  6. #6
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: VBA does not correct the notation of functions and variables that are located in a .xl

    VBA underlying application will normally standardize declared variables and function names, I am no expert on how the logic is applied, but I would assume that it would look in .xlam modules for reference functions and macro names when they are used in .xlsm workbooks. So I cannot explain why that particular code is giving you a problem. I have tried to duplicate it and cannot. Mine all changes to the same case throughout, Based on what the original usage or declaration was. Is it possible that you have anoter macro or function in the .xlam file that uses the same variables but with the upper case letters? (although, I don't see how that could be, based on the application standard). Big mystery!

+ 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. search 2 variables, return the correct one beside each match
    By katri80 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-12-2016, 03:39 PM
  2. for/next Correct Syntax for Ranges with variables
    By beat in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-19-2013, 11:14 AM
  3. Replies: 2
    Last Post: 04-28-2013, 05:55 PM
  4. Replies: 1
    Last Post: 02-25-2013, 04:25 PM
  5. Disabling scientific notation auto-correct
    By Ouka in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-09-2013, 03:25 AM
  6. XLAM public variables
    By gm13958 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-08-2012, 09:52 AM
  7. Log Book - the correct functions
    By ASITC in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2010, 05:03 AM

Tags for this Thread

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