Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50194

Save as with variable file name and directory (simple no!)

$
0
0
Hi All,

Have spent a few hours going through this forum again and cannot find my answer (Probably poor search technique))

I have a macro that finishes by copying a sheet (tab) to a new work book.

The problem comes when I try to save it. all the posts I have found hard code the file name and directory, these need to be selected by the users

Below are many tries, all those with " ' " do not work

attached is the output sheet that has to be saved (can't use template as to much sensitve data)

Code:

Range("A1").Select
   
    Sheets("IPLUS Output").Select
    Sheets("IPLUS Output").Copy
   
 
    Application.DisplayAlerts = False
 '  ActiveWorkbook.saveas myfilename

    '  Fname = "IPLUS Output"
   
   
 '    Sub SaveSheet()'
'Dim savingname As String
 '  ActiveSheet.Copy
 '  savingname = Application.GetSaveAsFilename(ActiveSheet.Name & ".xlsx")
 '  If savingname = "False" Then ActiveWorkbook.Close False: Exit Sub
 '  ActiveWorkbook.saveas savingname
' End Sub


  '  Sheets(Fname).Copy
  '    ActiveWorkbook.saveas Filename:=myPath & Fname & ".csv", FileFormat:=6, CreateBackup:=False
  '    ActiveWorkbook.Close
'End Sub

'  Set NewBook = Workbooks.Add
'Do
'    Fname = Application.GetSaveAsFilename
'Loop Until fName <> False
'NewBook.SaveAs Filename:=fName

Attached Files

Viewing all articles
Browse latest Browse all 50194

Trending Articles