+ Reply to Thread
Results 1 to 6 of 6

Need file to close automatically - and if posssible, after the close, folder be on screen

  1. #1
    Forum Contributor
    Join Date
    07-02-2012
    Location
    Florida
    MS-Off Ver
    Home -Excel 2007, Work 2016
    Posts
    254

    Need file to close automatically - and if posssible, after the close, folder be on screen

    The following assigns the file a name and then asks user to select the folder in should be save in.
    I want the file to save and close after they select the folder but it is giving the user the opportunity to save it.
    Also - if possible - I would like for the screen, after the file is saved and closed to be the folder in which the file was saved.00000000
    That possible??

    Sub SaveAnyFile()
    MsgBox "Next you will see the file name assigned to this payment, Following that you will be asked to select the lien folder of the Job Folder to which this invoice pertains."
    Dim folder, name As String
    On Error Resume Next
    name = Sheet1.Range("C11").Value & " - " & Sheet1.Range("C13").Value & " - " & Sheet1.Range("C18").Value & ".xlsm"
    MsgBox name
    With Application.FileDialog(msoFileDialogFolderPicker)
    .Title = "Please select a folder"
    .AllowMultiSelect = False
    .Show
    folder = .SelectedItems(1)
    End With
    name = Application.GetSaveAsFilename(InitialFileName:=folder & "\" & name, FileFilter:="Macro Enabled Workbook (*.xlsm), *.xlsm", Title:="Save As File")
    ActiveWorkbook.SaveAs Filename:=name, FileFormat:=xlOpenXMLWorkbookMacroEnabled
    ActiveWorkbook.Close
    End Sub

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Need file to close automatically - and if posssible, after the close, folder be on scr

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-02-2012
    Location
    Florida
    MS-Off Ver
    Home -Excel 2007, Work 2016
    Posts
    254

    Re: Need file to close automatically - and if posssible, after the close, folder be on scr

    File closes and screen shows folder file was saved in which is super!!
    BUT - after folder is selected by the user, the next thing up on the screen is the file and the folder -for the user to save.
    I need that save to be taken care of by the macro - not an option for the user but don't see the change that needs to be made to make that happen.
    Hope somebody does!!!

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Need file to close automatically - and if posssible, after the close, folder be on scr

    Use FileSave().

  5. #5
    Forum Contributor
    Join Date
    07-02-2012
    Location
    Florida
    MS-Off Ver
    Home -Excel 2007, Work 2016
    Posts
    254

    Re: Need file to close automatically - and if posssible, after the close, folder be on scr

    Regarding the much appreciated "Use FileSave()" - Thank you!!!
    BUT - Exactly were does it go?
    I had tried it before but did not find a place for it to fit.
    Suggestions????
    Thanks

  6. #6
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Need file to close automatically - and if posssible, after the close, folder be on scr

    I am not sure if you wanted to close the SaveAs file and the original. If not the later, delete the thisworkbook.close line.

    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: 12-02-2019, 03:42 PM
  2. VBA for open files from folder / calling function / save / close the file
    By janet2019 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2019, 06:16 PM
  3. [SOLVED] VBA to close file automatically
    By scrouse14 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-02-2015, 09:59 AM
  4. [SOLVED] VBA Prompt to close PDF so file can be overwrtitten or close automatically
    By bdouglas1011 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-21-2014, 12:31 PM
  5. Replies: 4
    Last Post: 05-20-2013, 08:31 AM
  6. automatically close file and save changes with a new name
    By 2funny4words in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-25-2009, 10:07 PM
  7. Close file automatically
    By Lee in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2005, 06: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