Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228

    Global Variables

    I've never used one and I don't anticipate this to work first time. I'm curious (Yes I have googled, couldn't see what I'm looking for)



    Can I create a global variable in access and use that in excel?

    In access I'm generating a file based on some fields. This file will be saved in a specific location.

    Excel will then open up and run a macro of its own. At them moment I am using the file dialog (defaulted in the correct place) to pick the file I have just made.

    I am trying to eliminate this step.

    I'm happy creating a function and calling it, but does it matter it's in a different application?

    Just some general advice is what I'm after to avoid wasting time if I'm wrong.

  2. #2
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    You can open the Excel file from Access (as you know the location), wouldn't that achieve the goal ?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Im opening the excel file already and I'm calling the macro within excel.

    This opens the file dialog to select a word document I have just made in access.

    Edit: sorry for not being clear, but the file dialog is ran in excel and is used to find a new file just created with a unique name in a specific location.

  4. #4
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Ok, why not store the file path in the newly created excel document in a specific cell, and use that?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #5
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    The excel file is constant, but thats a good idea. Didn't even think of doing it that way.
    Thanks a lot.

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

Similar Threads

  1. VBA is reseting all my global variables...
    By ohmydatabase in forum Access
    Replies: 7
    Last Post: 10-14-2017, 03:02 AM
  2. Declaring Global Variables with DLookup?
    By mrmims in forum Programming
    Replies: 2
    Last Post: 09-04-2016, 07:03 AM
  3. Cannot create Global Variables
    By Paul H in forum Programming
    Replies: 3
    Last Post: 05-20-2014, 11:27 AM
  4. Global Variables?
    By futurezach in forum Reports
    Replies: 4
    Last Post: 06-20-2013, 03:45 PM
  5. Setting global variables
    By Remster in forum Programming
    Replies: 1
    Last Post: 08-24-2011, 08:47 AM

Posting Permissions

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