View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default Create a New Workbook

Are you looking to return the current time?

You can use VBA's builtin Time or Date:

Option Explicit
Sub testme01()

Dim justTime As Date
justTime = Time
MsgBox justTime

'or
Dim DateAndTime As Date
DateAndTime = Now
MsgBox DateAndTime

'or
Dim justDate As Date
justDate = Date
MsgBox justDate

End Sub



kaykayIT wrote:

I created a worksheet template but the problem is that a new workbook is not
created when the new worksheet is created. The purpose of a new workbook is
to get the creation date of the workbook for subtracting time out from time
in.(See Code Below)

Cells(30, 3).Value =
Format(Application.ActiveWorkbook.BuiltinDocumentP roperties("Creation Date"),
"h:mm am/pm")

How do I use VBA to create a new workbook and can I put an icon on the
desktop to run this code?


--

Dave Peterson