+ Reply to Thread
Results 1 to 3 of 3

Saving Copy of Template

  1. #1
    Forum Contributor
    Join Date
    02-20-2017
    Location
    Indiana
    MS-Off Ver
    2016
    Posts
    101

    Saving Copy of Template

    Hello,

    I'm working with a .xlsb template file that pulled data from SAP, then runs a Macro to format the data. The template macro needs to run multiple times, so I need help saving the workbook without actually saving the template. I'm trying to use the SaveCopyAs command now, but I'm getting an error with my FileFormat. Any help would be appreciated. Here's my code so far.

    Sub Save()
    Dim FileName As String
    Dim Path As String
    Dim DateValue As String
    Dim WbsValue As String

    Sheet6.Select
    DateValue = Range("B3")
    WbsValue = Range("A1")
    WbsValue = Replace(WbsValue, ".", "")
    WbsValue = Replace(WbsValue, "-", "")
    FileName = DateValue & "_" & WbsValue


    Path = "C:\Users\xqs2269\Desktop\Bi-Monthly Commerical\"

    ActiveWorkbook.SaveCopyAs FileName:= _
    Path & FileName _
    , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

    End Sub

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Saving Copy of Template

    The SaveCopyAs command doesn't have a file format argument. It only has a FileName argument.

    An alternate solution is to copy all the sheets to a new workbook then use SaveAs on the new workbook.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    02-20-2017
    Location
    Indiana
    MS-Off Ver
    2016
    Posts
    101

    Re: Saving Copy of Template

    Thanks for the suggestion. This worked excellent.

+ 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. [SOLVED] VBA not saving template
    By mickyh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-08-2015, 07:44 PM
  2. Replies: 1
    Last Post: 05-23-2013, 02:04 PM
  3. Replies: 4
    Last Post: 01-04-2013, 01:38 PM
  4. CSV file created from template is not saving to same location as the template.
    By SGALLAG1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-12-2012, 11:26 AM
  5. Replies: 0
    Last Post: 02-28-2012, 11:40 AM
  6. saving template
    By Marlis in forum Excel General
    Replies: 3
    Last Post: 09-10-2005, 08:07 PM
  7. [SOLVED] Saving CSV to a template
    By Josh O. in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2005, 08:06 PM

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