Results 1 to 7 of 7

Ambiguous name detected: wb

  1. #1
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    411

    Ambiguous name detected: wb

    Hello,

    I created different subroutines in different modules and use variables such as



    dim x as excel.application
    xn = fn1.xlsx
    Set wb = x.workbooks.open(p,false,false)

    Then I created these variable for another excel file in different module.

    xn = fn2.xlsx

    I get ambiguous name detected wb, x, xn etc. how do I resolve this ?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    47,482
    Ambiguous means VBA is confused by duplicate declarations. Do you have variables declared in module header?

    To open a workbook object, need full file path, not just workbook name.

    Every module should have Option Explicit in header.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    411
    Hi June,

    I have that resolved.
    I was working with two files so I created two separate public wb as excel.workbook that caused the ambiguous name detection. I just deleted one and only use one.

    However now I have another issues, the issue is how can I make

    PowerPoint presentation and
    PowerPoint application

    global where if I make it public but can use it in other module referring to the same power point application and slide ?

    It came empty in the module when I make the power point presentation and application variables public.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    47,482
    Variables declared in header of a general module should be available to all modules.
    https://blueclawdatabase.com/tutoria...bal-variables/
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    411
    Thanks for the link will give it a try.

  6. #6
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    411
    June, it seems sometimes the global variables works and sometimes it doesnt. I dont know why, do you ?

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    47,482
    I would have to examine db and run code.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Ambiguous name detected (Isloaded)
    By CHEECO in forum Database Design
    Replies: 2
    Last Post: 12-02-2017, 06:42 PM
  2. Compile Error: ambiguous name detected
    By bronson_mech in forum Programming
    Replies: 2
    Last Post: 01-19-2017, 07:31 AM
  3. Replies: 3
    Last Post: 04-23-2016, 10:43 PM
  4. Replies: 11
    Last Post: 06-04-2014, 10:58 AM
  5. Replies: 2
    Last Post: 06-23-2012, 11:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums