ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SaveAs Method changes Worksheet Name (https://www.excelbanter.com/excel-programming/330371-saveas-method-changes-worksheet-name.html)

nmagerl[_3_]

SaveAs Method changes Worksheet Name
 

I am using the following code in a form running from a Macro in Exce
2002:
filesavename = Application.GetSaveAsFilename("", _
fileFilter:="CSV Files (*.CSV), *.csv")

If filesavename < False Then
MsgBox "Save As " & filesavename
End If
ActiveWorkbook.SaveAs filesavename, FileFormat:=xlCSV

The workbook saves as a new CSV file but changes the name of the activ
sheet.
What can I do about this?

Thank

--
nmager
-----------------------------------------------------------------------
nmagerl's Profile: http://www.msusenet.com/member.php?userid=161
View this thread: http://www.msusenet.com/t-187045632


Dave Peterson[_5_]

SaveAs Method changes Worksheet Name
 
Maybe you could just copy that worksheet to a new workbook and then save from
the

Option Explicit
Sub testme01()
Dim FileSaveName As Variant

FileSaveName = Application.GetSaveAsFilename("", _
fileFilter:="CSV Files (*.CSV), *.csv")

If FileSaveName < False Then
MsgBox "Save As " & FileSaveName
ActiveSheet.Copy 'to a new workbook
ActiveWorkbook.SaveAs FileSaveName, FileFormat:=xlCSV
ActiveWorkbook.Close savechanges:=False
End If

End Sub

nmagerl wrote:

I am using the following code in a form running from a Macro in Excel
2002:
filesavename = Application.GetSaveAsFilename("", _
fileFilter:="CSV Files (*.CSV), *.csv")

If filesavename < False Then
MsgBox "Save As " & filesavename
End If
ActiveWorkbook.SaveAs filesavename, FileFormat:=xlCSV

The workbook saves as a new CSV file but changes the name of the active
sheet.
What can I do about this?

Thanks

--
nmagerl
------------------------------------------------------------------------
nmagerl's Profile: http://www.msusenet.com/member.php?userid=1614
View this thread: http://www.msusenet.com/t-1870456325


--

Dave Peterson

nmagerl[_4_]

SaveAs Method changes Worksheet Name
 

Thanks Dave,
I will do that although it is my last choice. I would really like t
know what I am doing that causes this to occur.

Nic

--
nmager
-----------------------------------------------------------------------
nmagerl's Profile: http://www.msusenet.com/member.php?userid=161
View this thread: http://www.msusenet.com/t-187045632


Dave Peterson[_5_]

SaveAs Method changes Worksheet Name
 
That's the way excel behaves--even when you do it manually.



nmagerl wrote:

Thanks Dave,
I will do that although it is my last choice. I would really like to
know what I am doing that causes this to occur.

Nick

--
nmagerl
------------------------------------------------------------------------
nmagerl's Profile: http://www.msusenet.com/member.php?userid=1614
View this thread: http://www.msusenet.com/t-1870456325


--

Dave Peterson

nmagerl[_5_]

SaveAs Method changes Worksheet Name
 

Thanks Dave,
Looks like that's the way I have to do it.
I appreciate the assistance.
Nic

--
nmager
-----------------------------------------------------------------------
nmagerl's Profile: http://www.msusenet.com/member.php?userid=161
View this thread: http://www.msusenet.com/t-187045632



All times are GMT +1. The time now is 10:51 PM.

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