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: 5,302
Default Command Button Macro SheetNew Workbook

Hi Jpg_2,

Try:

'=============
Public Sub Tester04A()
Dim SStr As String
Const sName As String = "ABCD" '<<==== CHANGE

SStr = sName & Format(Now, "yyyymmdd hh-mm") & ".xls"

ActiveSheet.Copy
ActiveWorkbook.SaveAs _
Filename:=SStr, _
FileFormat:=xlWorkbookNormal
End Sub
'<<=============

Change ABCD to a name which suits your purpose.

Each file created, will bear this name with an appended date and time.

As written, only one file could be created in any given minute If this is a
problem, extend the time format to encompass seconds.
..
---
Regards,
Norman


"jgp_2" wrote in
message ...

Norman -

Thanks for your help. It is working somewhat, but everytime it sends
the sheet to a new workbook I receive a message that says: "A File
Named NewWorkBookName.xls already exists in this location. Do You want
to replace it?"

I changed the name of "NewWorkbookName.xls". It always works the first
time, but if you close the new workbook and try it again the error pops
up.

Any suggestions you have would be appreciated.

Thanks again!!!



Norman Jones Wrote:
Hi Jgp_2,

Try assigning code like the following to a button:

'=============
Public Sub Tester04()
ActiveSheet.Copy
ActiveWorkbook.SaveAs _
Filename:=("NewWorkbookName.xls"), _
FileFormat:=xlWorkbookNormal
End Sub
'<<=============


---
Regards,
Norman



"jgp_2" wrote in
message
...

Hello everybody.

Hopefully someone can help me with this as I am stuck.(As usual):)

I want to add a command button to a report that when clicked will

copy
the sheet into a new book.

I assume that this can be acheived throuch a Macro, but everything

I've
tried thus far has failed.

Thanks for your help!


--
jgp_2

------------------------------------------------------------------------
jgp_2's Profile:
http://www.excelforum.com/member.php...o&userid=27624
View this thread:

http://www.excelforum.com/showthread...hreadid=489219



--
jgp_2
------------------------------------------------------------------------
jgp_2's Profile:
http://www.excelforum.com/member.php...o&userid=27624
View this thread: http://www.excelforum.com/showthread...hreadid=489219



 
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
Open a Workbook using a Command Button aussiegirlone Excel Discussion (Misc queries) 2 April 7th 09 03:56 AM
Use macro(command button) paste special in 2nd sheet deen Excel Worksheet Functions 5 February 25th 08 01:04 PM
Command Button crashing workbook? Kaval Excel Discussion (Misc queries) 1 July 15th 05 12:12 AM
How do I create a command button to jump from sheet to sheet in a. Darlenew Excel Worksheet Functions 3 March 22nd 05 10:36 PM
Command Button to Save As Workbook... RPIJG[_13_] Excel Programming 1 May 12th 04 08:59 PM


All times are GMT +1. The time now is 06:38 AM.

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"