ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with SaveAs (https://www.excelbanter.com/excel-programming/291309-help-saveas.html)

Glen Mettler[_2_]

Help with SaveAs
 
Trevor put me on the right track to save an individual worksheet
programmatically. However, I still have a problem. When I open the saved
sheet it has the formulas linked back to the parent workbook. How can I
save this with values only and eliminate the link?

Here is the code I am using:
sheetname = ActiveSheet.Name
ActiveSheet.Copy
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs filename:= _
CARTpath & "\" & sheetname & ".xls" _
, FileFormat:=xlNormal, Password:="",
WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Application.DisplayAlerts = True

also I can't find any information about "FileFormat:=xlNormal" What other
options are availabe besides xlNormal?

Thanks
Glen



Dave Peterson[_3_]

Help with SaveAs
 
add these lines after the activesheet.copy statement:

with activesheet.usedrange
.value = .value
end with

Or record a macro that selects all the cells and copies|pastes special|values.

And put your cursor over .SaveAs in your code.
Hit F1.
Click on "show all" in the top right corner.
click on "fileformat"
click on "xlfileformat"

Or hit F2 in the VBE (to get to the object browser)
search for fileformat.
You should see lots of possibilities.

Glen Mettler wrote:

Trevor put me on the right track to save an individual worksheet
programmatically. However, I still have a problem. When I open the saved
sheet it has the formulas linked back to the parent workbook. How can I
save this with values only and eliminate the link?

Here is the code I am using:
sheetname = ActiveSheet.Name
ActiveSheet.Copy
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs filename:= _
CARTpath & "\" & sheetname & ".xls" _
, FileFormat:=xlNormal, Password:="",
WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Application.DisplayAlerts = True

also I can't find any information about "FileFormat:=xlNormal" What other
options are availabe besides xlNormal?

Thanks
Glen


--

Dave Peterson



All times are GMT +1. The time now is 11:45 PM.

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