LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Saving an unactivated worksheet

Hi,

I have a workbook by the name -- " ABC.xls"

It could be possible that it is not activated.

I want to save this workbook by appending todays' date to the present name.

I wrote the code ( Pinched it from NG) :-

Windows("ABC.xls").Activate
If InStr(ActiveWorkbook.Name, CStr(Format(Now, "dd-mmm-yy"))) = 0 Then
ActiveWorkbook.SaveAs filename:= _
"C:\Documents and Settings\hprasadh\Desktop\xyz\Project comparison\ABC
" & " " & CStr(Format(Now, "dd-mmm-yy")), FileFormat:=xlNormal
End If

The above is part of a bigger code and my code gets a compile error at the
point Windows("ABC.xls").Activate . I tried changing it to

Windows("ABC").Activate but to no avail.

Curiously at other points of the code also when I try to activate this sheet
using this line ( in order to perform some cut paste operation) it bombs at
the same point.

1. Please tell me why this is happening.

2. Is there a way I can save the "ABC.xls" as a new workbook with the
filename "C:\Documents and Settings\hprasadh\Desktop\xyz\Project
comparison\ABC " & " " & CStr(Format(Now, "dd-mmm-yy")),
FileFormat:=xlNormal. Why Im asking this is presently while saving
ActiveWorkbook.SaveAs filename statement has to be used and if there is a
way one could save a POSSIBLY unactivated sheet without first activating it
my problem may be solved. ( Still please do tell me at the firs place why is
the activate code not working)

{ The file does have the name "ABC" only. I copied the filename from
rightclick properties to doublecheck }

Regards,
Hari
India






 
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
Saving a worksheet Ed Davis[_2_] Excel Discussion (Misc queries) 2 September 28th 09 12:40 AM
Saving a Worksheet Sibbs Excel Discussion (Misc queries) 3 February 4th 08 01:39 PM
Saving a worksheet JONESAROB Excel Discussion (Misc queries) 2 August 3rd 06 07:59 PM
Saving a Worksheet GoBucks Excel Discussion (Misc queries) 3 January 27th 05 07:37 PM
VBA: saving as with the name of the worksheet steve a Excel Programming 2 June 3rd 04 06:28 AM


All times are GMT +1. The time now is 11:18 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"