+ Reply to Thread
Results 1 to 3 of 3

Save as cell value - small issue

  1. #1
    Registered User
    Join Date
    11-10-2015
    Location
    Derbyshire
    MS-Off Ver
    Office 2013
    Posts
    17

    Save as cell value - small issue

    Hello all,

    My second post after some excellent help the other day. I have a new workbook that I have created and the final function I need it to do is to save with a filename based on the value of a cell. I have written the below code which correctly opens up the save as window which is great, however the file name field is blank and not the value of cell C32.

    Any tips or pointers to help me work this one out? Think it’s just failing to find the right cell value??


    Sub Save()

    Dim flToSave As Variant
    Dim flName As String
    Dim flFormat As Long

    flFormat = ActiveWorkbook.FileFormat
    flName = Worksheets("Store & Scheme Details").Range("C32").Value
    flToSave = Application.GetSaveAsFilename _
    (ThisWorkbook.Path & "\" & flName, filefilter:="Excel Files (*.xlsm), *.xlsm", _
    Title:="Save FileAs...")

    If flToSave = False Then
    Exit Sub
    Else

    ThisWorkbook.SaveAs FileName:=flToSave, FileFormat:=flFormat
    End If

    End Sub

  2. #2
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Re: Save as cell value - small issue

    I think this might do close to what you are wanting

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-10-2015
    Location
    Derbyshire
    MS-Off Ver
    Office 2013
    Posts
    17

    Re: Save as cell value - small issue

    Hello cheers for the response It works all the way up until the point of: Workbooks.Open Filename:=sPath & sFile


    Where I'm then presented with the error that Excel cannot open the file as the file format or extension is not valid.

    Just trying to work through it now, xlsm seems valid to me!

+ 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] Small Issue with Type Mismatch and Invalid Qualifier when setting variable value from cell
    By TomToms in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-10-2014, 08:03 AM
  2. [SOLVED] Aggregate, Small issue
    By JO505 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-28-2013, 03:44 PM
  3. [SOLVED] Small issue with data validation
    By Naja in forum Excel General
    Replies: 3
    Last Post: 03-07-2013, 05:44 PM
  4. if, index, small - formula issue
    By jw01 in forum Excel General
    Replies: 6
    Last Post: 10-24-2012, 01:21 AM
  5. if(small(index...formula issue
    By jw01 in forum Excel General
    Replies: 7
    Last Post: 01-26-2012, 12:05 PM
  6. if..small..rows - logic issue
    By jw01 in forum Excel General
    Replies: 9
    Last Post: 12-09-2011, 02:18 PM
  7. Large/Small Function Issue
    By ihdalton in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-28-2009, 10:31 AM

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