![]() |
savecopyas saves as file type
Dim MyNewFileName As Variant
Dim Text1 As String Dim Text3 As String Text1 = "Program Status" Text3 = "NEXT" MyNewFileName = Text1 & " " & Text3 ActiveWorkbook.SaveCopyAs Filename:=MyNewFileName above code works, but resulting file "Program Status NEXT" is a "file" type, not an xls. however, when double-clicking on it in windows explorer, it does open with excel. i tried replacing last statement with: ActiveWorkbook.SaveCopyAs Filename:=MyNewFileName, _ FileFormat:=xlWorkbookNormal but i get a "compile error......... named argument not found". any suggestions? TIA susan |
savecopyas saves as file type
How about just adding .xls to your string?
MyNewFileName = Text1 & " " & Text3 & ".xls" But since you're using .SaveCopyAs, it'll always be an exact copy--including the format of the file. Susan wrote: Dim MyNewFileName As Variant Dim Text1 As String Dim Text3 As String Text1 = "Program Status" Text3 = "NEXT" MyNewFileName = Text1 & " " & Text3 ActiveWorkbook.SaveCopyAs Filename:=MyNewFileName above code works, but resulting file "Program Status NEXT" is a "file" type, not an xls. however, when double-clicking on it in windows explorer, it does open with excel. i tried replacing last statement with: ActiveWorkbook.SaveCopyAs Filename:=MyNewFileName, _ FileFormat:=xlWorkbookNormal but i get a "compile error......... named argument not found". any suggestions? TIA susan -- Dave Peterson |
savecopyas saves as file type
Dave Peterson wrote: How about just adding .xls to your string? i thought that would just create a file name that tacked .xls on the end, not influence the type of file. But since you're using .SaveCopyAs, it'll always be an exact copy--including the format of the file. then why is the copy a file, not an .xls? just wondering, will try the .xls add-on to filename. thanks! susan |
savecopyas saves as file type
Dave Peterson wrote:
MyNewFileName = Text1 & " " & Text3 & ".xls" it worked, thanks a lot....... but still wondering why the saveascopy didn't work. thank you! susan |
savecopyas saves as file type
The file was a real excel file. But the name didn't include the extension.
Much like if you renamed the file in windows explorer. You could still use file|open to open that file and all your formulas, formatting, data would still be there. Susan wrote: Dave Peterson wrote: How about just adding .xls to your string? i thought that would just create a file name that tacked .xls on the end, not influence the type of file. But since you're using .SaveCopyAs, it'll always be an exact copy--including the format of the file. then why is the copy a file, not an .xls? just wondering, will try the .xls add-on to filename. thanks! susan -- Dave Peterson |
All times are GMT +1. The time now is 04:08 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com