+ Reply to Thread
Results 1 to 13 of 13

macro to open file

  1. #1
    Registered User
    Join Date
    10-27-2017
    Location
    belgium
    MS-Off Ver
    2003
    Posts
    7

    macro to open file

    Dear,

    I got a button on my form when you click on it , it should check if the file already exist, when it exist it should open the file,
    when it not exist it should make the file and open it.
    the filename should include the weeknumber and the date, but it does not work

    Please Login or Register  to view this content.
    Last edited by AliGW; 10-27-2017 at 03:11 AM. Reason: Code tags added.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,262

    Re: macro to open file

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (I have done it for you this time - next time you must do it yourself.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    10-27-2017
    Location
    belgium
    MS-Off Ver
    2003
    Posts
    7

    Re: macro to open file

    sorry did not see it, next time i will put it between quotes

  4. #4
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: macro to open file

    Please Login or Register  to view this content.

    then run the vba code using the function

    Please Login or Register  to view this content.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,262

    Re: macro to open file

    Quote Originally Posted by drek1234 View Post
    sorry did not see it, next time i will put it between quotes
    No, not quotes - use code tags (# on the toolbar). Thanks.

  6. #6
    Registered User
    Join Date
    10-27-2017
    Location
    belgium
    MS-Off Ver
    2003
    Posts
    7

    Re: macro to open file

    Thx buth if i paste the code in my sheet nothing happens if i click the button,
    sorry i am not goog in this

    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: macro to open file

    Is the code linked to the button?

    can you attach the file
    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  8. #8
    Registered User
    Join Date
    10-27-2017
    Location
    belgium
    MS-Off Ver
    2003
    Posts
    7

    Re: macro to open file

    i hope the attachment is include, we got 3 machines and we wanna know who use the machine and how much
    so in first excel menu we click the button and in the directory of the machine we have to open a new excel
    file where the user must fill in the data, for every weeknumber there must be a new sheet with weeknumber
    and dateso if it exist then the button should open it, if a new week begin it should make a new sheet
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: macro to open file

    It works for me, I assume your security levels allow macros to run?

  10. #10
    Registered User
    Join Date
    10-27-2017
    Location
    belgium
    MS-Off Ver
    2003
    Posts
    7

    Re: macro to open file

    macro's are enabled so you can open a new file or create ? then going to check it again

  11. #11
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: macro to open file

    Yes it runs fine!

  12. #12
    Registered User
    Join Date
    10-27-2017
    Location
    belgium
    MS-Off Ver
    2003
    Posts
    7

    Re: macro to open file

    yes stupid me the msgbox file exist was gone so i thougt nothing happens
    thx very much it works; is it possible to place a button on the new sheet
    with a macro when the new file is load ?

  13. #13
    Registered User
    Join Date
    10-27-2017
    Location
    belgium
    MS-Off Ver
    2003
    Posts
    7

    Re: macro to open file

    Ok im a found more things to make my sheet now i can put a button on the new opened worksheet what i dont find
    is how i can click on the new button and close the new work sheet and save it with the new buttun "called" testbutton
    I also can put data to a cell in the new open file, can someone help with that button ?
    Thanks in advantage
    Please Login or Register  to view this content.

+ 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. Replies: 8
    Last Post: 11-25-2015, 08:14 PM
  2. [SOLVED] VBA Open File/Run Macro/Close &Save/Open Next File
    By JPSIMMON in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-21-2015, 12:16 PM
  3. Macro - Open File Explorer, Select File, Import certain information from file
    By Drayde in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2015, 08:58 AM
  4. [SOLVED] Macro that prompts user to select a file to open and perform another macro on this file
    By grimmy26 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-16-2014, 08:39 AM
  5. [SOLVED] Macro - Master file to import data from another open file with variable file name
    By jdodz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-10-2012, 10:56 PM
  6. macro prompts immediately to open a file once the Excel file with the macro is opened
    By jhmayor03 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-03-2012, 10:00 AM
  7. [SOLVED] Open a file do a macro ( made) and open next succesive file
    By SVTman74 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-21-2006, 05:20 PM

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