Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-01-2011, 07:25 AM
tinfanide tinfanide is offline SaveCopyAs Windows 7 64bit SaveCopyAs Office 2010 32bit
Expert
SaveCopyAs
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default SaveCopyAs

I'm using Excel and create a button that runs the assigned macro:

Code:
ActiveWorkbook.SaveCopyAs "C:\" & Range("B2").Value & ".xls", FileFormat:=56
But this one just saves/overwrites the file itself.

Another one that just forces users to save the file; if not, cannot exit the window:



Code:
Sub forceSaveAs()

Dim NewBook
Dim fName

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

End Sub
Is it a better way or how can I use SaveCopyAs to do so?
Reply With Quote
  #2  
Old 11-02-2011, 01:32 AM
macropod's Avatar
macropod macropod is offline SaveCopyAs Windows 7 64bit SaveCopyAs Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi tifanide,

If you want the user to continue working in the newly-saved workbook, you could use:
ActiveWorkbook.SaveAs Filename:="C:\" & Range("B2").Value & ".xls", FileFormat:=56
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-02-2011, 06:02 AM
tinfanide tinfanide is offline SaveCopyAs Windows 7 64bit SaveCopyAs Office 2010 32bit
Expert
SaveCopyAs
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

Thanks for that.
Reply With Quote
Reply



Other Forums: Access Forums

All times are GMT -7. The time now is 07:53 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft