Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Randon file saves Gary''s Student Excel Discussion (Misc queries) 1 October 24th 06 09:09 PM
File saves as XML back to XLS? Lynn Excel Discussion (Misc queries) 1 May 2nd 06 06:46 PM
excel file saves Cell reference as the file name field Excel Discussion (Misc queries) 2 November 30th 05 04:31 PM
Retrieve File Name before its saves ExcelMonkey[_168_] Excel Programming 1 September 28th 04 12:39 PM
SaveCopyAs cannot access opened file? dule Excel Programming 5 February 18th 04 06:46 PM


All times are GMT +1. The time now is 08:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"