#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default SaveAs...

Hi,

I'm trying to write some code that will allow me to do
this:

if thisworkbookalreadysaved then
activework.save
else
filesavename = Application.GetSaveAsFilename
(fileFilter:="Microsoft Excel Workbook (*.xls), *.xls")

If filesavename < False Then ActiveWorkbook.SaveAs
Filename:=filesavename, FileFormat:=xlNormal
end if

the key issue is whether the workbook has been saved in
the past and there is a directory path to it - if, so then
just save it, if not then bring up the saveas dialog box

thks...Chris



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default SaveAs...

If thisworkbook.path = "" then
'never saved before


(Don't you hate it when the answer is in your own question!!! <bg)

Chris Gorham wrote:

Hi,

I'm trying to write some code that will allow me to do
this:

if thisworkbookalreadysaved then
activework.save
else
filesavename = Application.GetSaveAsFilename
(fileFilter:="Microsoft Excel Workbook (*.xls), *.xls")

If filesavename < False Then ActiveWorkbook.SaveAs
Filename:=filesavename, FileFormat:=xlNormal
end if

the key issue is whether the workbook has been saved in
the past and there is a directory path to it - if, so then
just save it, if not then bring up the saveas dialog box

thks...Chris


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default SaveAs...

Chris,

Test the ThisWorkbook.Path property. If it is empty, then the
workbook has never been saved. For example,

If ThisWorkbook.Path < "" Then
ThisWorkbook.Save
Else
'.. GetSaveAsFilename
' SaveAs
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Chris Gorham" wrote in
message ...
Hi,

I'm trying to write some code that will allow me to do
this:

if thisworkbookalreadysaved then
activework.save
else
filesavename = Application.GetSaveAsFilename
(fileFilter:="Microsoft Excel Workbook (*.xls), *.xls")

If filesavename < False Then ActiveWorkbook.SaveAs
Filename:=filesavename, FileFormat:=xlNormal
end if

the key issue is whether the workbook has been saved in
the past and there is a directory path to it - if, so then
just save it, if not then bring up the saveas dialog box

thks...Chris





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
VBA SaveAs Value charlie Excel Discussion (Misc queries) 4 August 27th 07 11:33 PM
SaveAs Stan Halls Excel Worksheet Functions 5 November 28th 06 07:51 PM
saveas Nikita Excel Programming 1 September 17th 03 02:39 AM
SaveAs Darrin Henry Excel Programming 0 September 12th 03 10:09 PM
SaveAs Dave Peterson[_3_] Excel Programming 1 September 12th 03 12:44 AM


All times are GMT +1. The time now is 06:03 PM.

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

About Us

"It's about Microsoft Excel"