+ Reply to Thread
Results 1 to 9 of 9

Trying to Simplify Saving a file from A template

Hybrid View

  1. #1
    Registered User
    Join Date
    06-01-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    6

    Trying to Simplify Saving a file from A template

    I have searched and searched but have not found the answer for what I am trying to do. I have created a template to be used by my employees so they can get a snapshot of their weekly settlement(estimated only) after expenses etc.. are done. I have provide a link to the template(with erroneous dollar amounts) so that can be used for testing. What I am trying to do after lets say Trip Number and Dispatch date have been entered is to click on File>Save As and have the file show up as example: EstPay062511.xls whereas the 062511 would be the date of dispatch plus 7 days without the slashes. I have several things and keep coming up with run time errors or am asked to save the file as a macro embedded file which I do not want. Be advised I am new to using Excel and think I have done a good job on the template and I am just trying to tweak it to make easier for my drivers to use.

    Est_Pay_Test_template.xlt

    Cross Posted:http://www.mrexcel.com/forum/showthread.php?t=639000

    The following is the code I'm trying to use:
    Sub cmd_SaveToC_Drive()
    
    
    Dim strPath As String
    Dim strFolderPath As String
    Dim fileSaveName As Variant
    
    strFolderPath = "C:\Users\Thor\Desktop\Testing Folder\"
    ThisFile = (Sheets("Trip1").Range("B8").Value & "_" & "EstPay" & ".xls")
    
    fileSaveName = Application.GetSaveAsFilename(InitialFileName:=strFolderPath & ThisFile)
    If fileSaveName = False Then Exit Sub
    ThisWorkbook.SaveAs filename:=fileSaveName
    
    End Sub
    Last edited by ThunderGod; 06-10-2012 at 02:57 PM. Reason: Not able to attach template (.xlt) files to post
    Thanks

    Thor

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Trying to Simplify Saving a file from A template

    That is not actually a template. If you save the workbook as a *.xlt file then each time it opens it will create a new workbook. The original cannot be altered because it is not actually being used.

    See this
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    06-01-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Trying to Simplify Saving a file from A template

    I know this, I tried to attach the template to the post but it would not attach because the xlt file extension is not listed as a valid file for posting in this forum so I changed it to xls extension hoping that whoever reads this post will convert it back to a xlt file and use it for testing.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Trying to Simplify Saving a file from A template

    Thanks for the negative rep. I wish you luck with your search for a solution but I jam adding you to my ignore list

  5. #5
    Registered User
    Join Date
    06-01-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Trying to Simplify Saving a file from A template

    Just stating that If you had read the post correctly(before I edited it) i said that I was unable to attach the template to the post because the XLT file extension was not one of the approved file extensions. So I had change the file to XLS format. But now I have fixed that by providing a link to the file and I believe your answer wasn't quite was I was expecting. You could have easlily said "please provide a link to you file"

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Trying to Simplify Saving a file from A template

    Since you don't pay for your help, whatever answers you get are a bonus. If you had PM'd me for further help I might have helped but now you can solve your own problems, as a god I would think that would be simple.

    Basically, if you want to complain about my answer then employ me & pay for my time.

    Equally you could have zipped the file & uploaded that.

  7. #7
    Registered User
    Join Date
    06-01-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Trying to Simplify Saving a file from A template

    royUK:

    Here is the code I came up with, couldn't actually do what i wanted as I asked in the question I had but this works. I inserted a Form Button and assigned the Macro to it. The attached file is the final file I came up with.

    Sub FileSave()
          
        Dim DispDate As String
        Dim PayDate As String
        
            DispDate = Sheets("TripInfo").Range("C6").Value + 12
            PayDate = Format(DispDate, "mm-dd-yyyy")
        
    Application.DisplayAlerts = False
        ActiveWorkbook.SaveAs Filename:="C:\Users\Thor\Desktop\JCTPay\" & "EstPayFor_" & PayDate, _
            Password:="", WriteResPassword:="", _
            ReadOnlyRecommended:=False, CreateBackup:=False
    Application.DisplayAlerts = True
    
    End Sub
    Attached Files Attached Files

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Trying to Simplify Saving a file from A template

    Thundergod,

    If your issue has been solved, i will mark it as solved since you will not be able to do it yourself.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  9. #9
    Registered User
    Join Date
    06-01-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Trying to Simplify Saving a file from A template

    Ok, thx you can mark it solved

    Quote Originally Posted by arlu1201 View Post
    Thundergod,

    If your issue has been solved, i will mark it as solved since you will not be able to do it yourself.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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