savecopyas saves as file type

  • Thread starter Thread starter Susan
  • Start date Start date
S

Susan

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
 
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.
 
Dave said:
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 said:
MyNewFileName = Text1 & " " & Text3 & ".xls"

it worked, thanks a lot.......
but still wondering why the saveascopy didn't work.
thank you!
susan
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top