ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set mySavedSummary = ActiveWorkbook.SaveAs( ....... (https://www.excelbanter.com/excel-programming/386344-set-mysavedsummary-%3D-activeworkbook-saveas.html)

WhytheQ

Set mySavedSummary = ActiveWorkbook.SaveAs( .......
 
What am I doing wrong:

Dim mySavedSummary As Object
Set mySavedSummary = ActiveWorkbook.SaveAs(Filename:="R:\Statistics
\Example.xls")

....and how do I alter the above so that it does work?

Any help greatly appreciated,
J.


urkec

Set mySavedSummary = ActiveWorkbook.SaveAs( .......
 
Dim mySavedSummary As Object
ActiveWorkbook.SaveAs Filename:="R:\Statistics\Example.xls"
Set mySavedSummary = GetObject("R:\Statistics\Example.xls")


--
urkec


"WhytheQ" wrote:

What am I doing wrong:

Dim mySavedSummary As Object
Set mySavedSummary = ActiveWorkbook.SaveAs(Filename:="R:\Statistics
\Example.xls")

....and how do I alter the above so that it does work?

Any help greatly appreciated,
J.



NickHK

Set mySavedSummary = ActiveWorkbook.SaveAs( .......
 
You do not need to do anything, because a .SaveAs does not change the WB:

Private Sub CommandButton1_Click()
Dim WB As Workbook

Set WB = ActiveWorkbook

ActiveWorkbook.SaveAs "C:\New name.xls"
Debug.Print WB.FullName

End Sub

If you check .SaveAs in the Object Browser, you will see it is a Sub that
has no return value. Therefore, you cannot "Set" anything to it

NickHK

"WhytheQ" wrote in message
oups.com...
What am I doing wrong:

Dim mySavedSummary As Object
Set mySavedSummary = ActiveWorkbook.SaveAs(Filename:="R:\Statistics
\Example.xls")

...and how do I alter the above so that it does work?

Any help greatly appreciated,
J.





All times are GMT +1. The time now is 05:34 PM.

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