+ Reply to Thread
Results 1 to 2 of 2

Ambiguous name detected: Userform reads a global variable in module (VBA)

  1. #1
    Registered User
    Join Date
    06-03-2020
    Location
    Ipoh
    MS-Off Ver
    Microsoft 365 Pro Plus
    Posts
    1

    Ambiguous name detected: Userform reads a global variable in module (VBA)

    Hello Excel Experts Out There,

    I am a newbie and basically I am trying to read a global variable declared in a module (using Microsoft Visual Basic for Application) from a userform. The global variable "RTfile" is not declared anywhere else except in the module. "RTfile" is only read by the private sub in the userform. But the compiler keeps giving me "Ambiguous Name detected: RTfile" when it hits "RTfile.Close False" in the userform.

    I am sure the userform is able to see the global variable in the module.
    But not sure of a work around.

    Any suggestion or feedback is welcomed.
    Thanks.

    1) Module "Sort_ConvProg" (under "Module" folder) code:

    Please Login or Register  to view this content.
    2) Userform "Sort_Input1" (under "Form" folder) code:

    Please Login or Register  to view this content.

    2020-06-05_13h44_00.png
    2020-06-05_13h45_48.png

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Ambiguous name detected: Userform reads a global variable in module (VBA)

    You probably don't want to call the module, Sort_ConvProg, the same as a routine, Sort_ConvProg, within the module.

    Also the END command will clear all variables from memory, so you probably don't want that either

    BTW your images are way too small to read
    Cheers
    Andy
    www.andypope.info

+ 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. Ambiguous name detected
    By Mohd Sufri in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 02-11-2019, 12:12 AM
  2. [SOLVED] Using Global variable in module
    By erice in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-23-2018, 04:12 PM
  3. ambiguous name detected
    By RJ1969 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-10-2018, 09:27 PM
  4. [SOLVED] Ambiguous name detected
    By bralew in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-14-2016, 10:23 AM
  5. Global Variable in a module
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-21-2015, 10:08 AM
  6. How to Declare a Global Variable for a Module? Get the Border Color too!
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 09-19-2011, 03:37 AM
  7. [SOLVED] Global (Module) Variable Problem
    By Allen Geddes in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-21-2005, 11:40 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