Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Calendar Control


I don't think I am understanding how VBA handles the passing of objects
and stuff when a button is pressed.

Basically, I have a calender control with the name calendar1 and when I
press the command button I want to put the date into a cell. So the
code I have so far:


Code:
--------------------

Private Sub CommandButton1_Click(Calendar1 As Object)
Range("A1") = Calendar1.Value

End Sub

--------------------


But I get the Compile error:

Procedure declaration does not match description of event or procedure
having the same name.

Can someone explain how VBA handles the sending of objects into subs?


--
FCC
------------------------------------------------------------------------
FCC's Profile: http://www.excelforum.com/member.php...o&userid=35888
View this thread: http://www.excelforum.com/showthread...hreadid=557644

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Calendar Control


Well actually, the calender is part of a user form which the user uses
to enter an employee's name and their employment date.

Which is why I would like a command button to handle both the username
and the employment date at the same time.


--
FCC
------------------------------------------------------------------------
FCC's Profile: http://www.excelforum.com/member.php...o&userid=35888
View this thread: http://www.excelforum.com/showthread...hreadid=557644

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default Calendar Control

In which case the button should hide the userform and then you can place the
data in the worksheet and unload the form from memory (Me refers to the
container...form, that contains the control)

Private Sub CommandButton1_Click()
Me.Hide
Worksheets("Sheet1").Range("A1").Value = Calendar1.Value
Unload Me
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"FCC" wrote in message
...

Well actually, the calender is part of a user form which the user uses
to enter an employee's name and their employment date.

Which is why I would like a command button to handle both the username
and the employment date at the same time.


--
FCC
------------------------------------------------------------------------
FCC's Profile:
http://www.excelforum.com/member.php...o&userid=35888
View this thread: http://www.excelforum.com/showthread...hreadid=557644



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
Calendar control D. Excel Discussion (Misc queries) 0 July 3rd 07 11:19 PM
Calendar control gramps Excel Discussion (Misc queries) 1 December 10th 06 11:22 PM
Control disappeared problem - specifically, the Calendar Control JMMach[_2_] Excel Programming 0 December 16th 05 01:53 AM
Calendar Control Vern Rabe Excel Programming 1 May 24th 04 06:15 PM
Calendar Control: Can't exit design mode because control can't be created Rone Excel Programming 0 May 24th 04 04:01 PM


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