Results 1 to 4 of 4

"Save as" Macro to Network share

Threaded View

pjw23 "Save as" Macro to Network... 06-08-2011, 11:50 PM
Mordred Re: "Save as" Macro to... 06-08-2011, 11:58 PM
Mordred Re: "Save as" Macro to... 06-09-2011, 12:13 AM
pjw23 Re: "Save as" Macro to... 06-09-2011, 08:50 AM
  1. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: "Save as" Macro to Network share

    Thanks! A couple of things to start with.
    1. Does the value in C5 have an extension like .xls or xlsx?The following code assumes that it does not have an extension.
    Public Sub SaveAsC5()
        Dim fName As String, wb As Workbook
        Set wb = ActiveWorkbook
        fName = wb.Sheets(1).Range("C5").Value
        wb.SaveAs Filename:="G:\" & fName & ".xlsm"
    End Sub
    This code declares Sheet 1 as the sheet to use for the C5 value. If it differs from yours, change it accordingly. Also, notice the filename after wb.SaveAs, you have to declare the drive (in my case it is G:\) and then also notice the "&" that is used twice. Depending on your version, you have to declare the proper extension. If your version is 2003, us .xls. I am using 2010 so that is why I used .xlsm

    Regards:
    Last edited by Mordred; 06-09-2011 at 12:17 AM.

Thread Information

Users Browsing this Thread

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

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