ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save As macro (https://www.excelbanter.com/excel-programming/406593-save-macro.html)

robs3131

Save As macro
 
Hi all,

I've taken a macro that someone else created and modified it slightly - the
macro essentially brings up the "Save As" dialogue box (this is needed as
part of a larger macro). The macro works fine, the only thing being that now
when I go to the "Open" menu, there are the following two choices for Excel
files:

- Microsoft Office Excel Files
- All Microsoft Office Excel Files

Is there something I can change in the macro so that there is only one
choice when I to "Open"? Thanks for your help.

Code:

Private Sub cmdarchive_Click()

Dim intlen As Integer
Dim strnamewlen As String

Application.DisplayAlerts = False

' Save file name and path into a variable

intlen = Len(ActiveWorkbook.Name)
strnamewlen = Left(ActiveWorkbook.Name, intlen - 4)
template_file = strnamewlen

fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:="C:\temp\" + template_file + " " +
VBA.Strings.Format(Now, "mm-dd-yyyy") + ".xls", _
fileFilter:="Excel Files (*.xls), *.xls")

If fileSaveName = False Then
Exit Sub
End If

ActiveWorkbook.SaveAs Filename:= _
fileSaveName, FileFormat:=xlNormal, _
CreateBackup:=False

Application.DisplayAlerts = True


End Sub

--
Robert

JLGWhiz

Save As macro
 
When you see the display with the two choices, if there is a drop down arrow
to the right, try clicking it and see if it goes back to one choice.

"robs3131" wrote:

Hi all,

I've taken a macro that someone else created and modified it slightly - the
macro essentially brings up the "Save As" dialogue box (this is needed as
part of a larger macro). The macro works fine, the only thing being that now
when I go to the "Open" menu, there are the following two choices for Excel
files:

- Microsoft Office Excel Files
- All Microsoft Office Excel Files

Is there something I can change in the macro so that there is only one
choice when I to "Open"? Thanks for your help.

Code:

Private Sub cmdarchive_Click()

Dim intlen As Integer
Dim strnamewlen As String

Application.DisplayAlerts = False

' Save file name and path into a variable

intlen = Len(ActiveWorkbook.Name)
strnamewlen = Left(ActiveWorkbook.Name, intlen - 4)
template_file = strnamewlen

fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:="C:\temp\" + template_file + " " +
VBA.Strings.Format(Now, "mm-dd-yyyy") + ".xls", _
fileFilter:="Excel Files (*.xls), *.xls")

If fileSaveName = False Then
Exit Sub
End If

ActiveWorkbook.SaveAs Filename:= _
fileSaveName, FileFormat:=xlNormal, _
CreateBackup:=False

Application.DisplayAlerts = True


End Sub

--
Robert


robs3131

Save As macro
 
I just tried - there is no drop down arrow to the right.

--
Robert


"JLGWhiz" wrote:

When you see the display with the two choices, if there is a drop down arrow
to the right, try clicking it and see if it goes back to one choice.

"robs3131" wrote:

Hi all,

I've taken a macro that someone else created and modified it slightly - the
macro essentially brings up the "Save As" dialogue box (this is needed as
part of a larger macro). The macro works fine, the only thing being that now
when I go to the "Open" menu, there are the following two choices for Excel
files:

- Microsoft Office Excel Files
- All Microsoft Office Excel Files

Is there something I can change in the macro so that there is only one
choice when I to "Open"? Thanks for your help.

Code:

Private Sub cmdarchive_Click()

Dim intlen As Integer
Dim strnamewlen As String

Application.DisplayAlerts = False

' Save file name and path into a variable

intlen = Len(ActiveWorkbook.Name)
strnamewlen = Left(ActiveWorkbook.Name, intlen - 4)
template_file = strnamewlen

fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:="C:\temp\" + template_file + " " +
VBA.Strings.Format(Now, "mm-dd-yyyy") + ".xls", _
fileFilter:="Excel Files (*.xls), *.xls")

If fileSaveName = False Then
Exit Sub
End If

ActiveWorkbook.SaveAs Filename:= _
fileSaveName, FileFormat:=xlNormal, _
CreateBackup:=False

Application.DisplayAlerts = True


End Sub

--
Robert



All times are GMT +1. The time now is 10:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com