Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Writing VBA Routine in XL2007 to run on XL2002


I'm having difficulty with the calendar.value method in a userform that's
being used for "beginning and ending dates". I've tried two ways to run the
calendar. The first was to include the calendar control, which I got from
rondebruin.nl , in a userform where it pops up when a button on the same
userform is clicked and I tried another way by creating a separate userform
just for the calendar.

The dates will be initially posted to the startup userform and later put
into a spreadsheet form for printing.

When I do anything programmatically, e.g., setting the calendar.value,
retrieving the calendar.value.etc, I get a runtime error telling me that the
method has failed.
I can load the calendar userform with no problems but everytime I get to a
line such as

Private Sub Calendar1_Click()

StmtDtBegButton.Visible = False
BegDtTxt.Value = Format("BegDtTxt.Value", "mm/dd/yy")
BegDtTxt.Value = Calendar1.Value '<<<<<<
Unload BegDtCal
BegDtTxt.Visible = True
End Sub

The runtime error "-2147319765 (8002802b) : Method 'Value' of object
'_DMsacal70' failed" pops up.

Also, if it's any help, I am not able to change any property values for the
calender such as "Day Font" or "Grid Font" without getting an error msg
"Object library invalid or contains references to object definitions that
could not be found".
I can get into the "Custom Property Page", change the tab and visible methods.

I'm out of ideas on this end. Could use some help. Thx...JG
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Writing VBA Routine in XL2007 to run on XL2002


Hi John,

Am I correct in assuming that BegDtTxt is a textbox. If so then try the
following.

Private Sub Calendar1_Click()

StmtDtBegButton.Visible = False
BegDtTxt.Value = Format(Calendar1.Value, "mm/dd/yy")
Unload BegDtCal
BegDtTxt.Visible = True
End Sub

--
Regards,

OssieMac


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Writing VBA Routine in XL2007 to run on XL2002


OssieMac...thx for the quick reply.

Tried your suggestion but there's "no joy". Same error msg as before. I've
even DL'd and registered the 11.0 mscal.ocx and get the same msg.

I forgot to mention in my first post...I'm not running anything too exotic,
WIN XP SP3 and Office 2007 Pro SP1.

I also have VS2008 and wrote a VB routine sometime ago where I had a
calendar popup in the same userform as the buttons and didn't have any
problems. Getting the dates into Crystal Reports...that was another
situation.

Again, thx for the suggestion. Anything else would be greatly appreciated.

"OssieMac" wrote:

Hi John,

Am I correct in assuming that BegDtTxt is a textbox. If so then try the
following.

Private Sub Calendar1_Click()

StmtDtBegButton.Visible = False
BegDtTxt.Value = Format(Calendar1.Value, "mm/dd/yy")
Unload BegDtCal
BegDtTxt.Visible = True
End Sub

--
Regards,

OssieMac


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Writing VBA Routine in XL2007 to run on XL2002


Hi again John,

If I understand your 2nd question correctly then the following might help.
Get the color codes from the calendar properties dialog box.

Private Sub CommandButton1_Click()
With UserForm1.Calendar1
.BackColor = &HFFFF&

'Alternative code for color
'.BackColor = vbYellow

.GridFontColor = &HFF&
.GridLinesColor = &H0&
.TitleFontColor = &HFF0000
.DayFont.Name = "Times New Roman"
.GridFont.Name = "Arial"
.DayFont.Bold = True
End With
End Sub

--
Regards,

OssieMac


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Writing VBA Routine in XL2007 to run on XL2002


OssieMac...

I'm now sure there's something else going on that may directly involve the
OCX. Tried your latest suggestions and hit the same brickwall as soon as it
entered the first WITH line to change the background color.

Is there any problems running either v10 or v11 of mscal.ocx with the 2007
version of VBA?

Thx for hangin' in there, JG

"OssieMac" wrote:

Hi again John,

If I understand your 2nd question correctly then the following might help.
Get the color codes from the calendar properties dialog box.

Private Sub CommandButton1_Click()
With UserForm1.Calendar1
.BackColor = &HFFFF&

'Alternative code for color
'.BackColor = vbYellow

.GridFontColor = &HFF&
.GridLinesColor = &H0&
.TitleFontColor = &HFF0000
.DayFont.Name = "Times New Roman"
.GridFont.Name = "Arial"
.DayFont.Bold = True
End With
End Sub

--
Regards,

OssieMac




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Writing VBA Routine in XL2007 to run on XL2002


UPDATE: I got to thinking more about the fact that it wasn't my programming
(tho it's not the greatest) that was causing the problem but possibly the OCX.

I unreg'd mscal.ocx and while I was searching the registry (not recommended
for the the faint of heart) I came across a call an mscal.ocx in the Office12
folder, dated 2007. I reg'd that one and have to say there is definitely
"joy in whoville". Trouble is it to damn late right now to do anything about
it.

Thanks for your help...OssieMac

"John G." wrote:

OssieMac...

I'm now sure there's something else going on that may directly involve the
OCX. Tried your latest suggestions and hit the same brickwall as soon as it
entered the first WITH line to change the background color.

Is there any problems running either v10 or v11 of mscal.ocx with the 2007
version of VBA?

Thx for hangin' in there, JG

"OssieMac" wrote:

Hi again John,

If I understand your 2nd question correctly then the following might help.
Get the color codes from the calendar properties dialog box.

Private Sub CommandButton1_Click()
With UserForm1.Calendar1
.BackColor = &HFFFF&

'Alternative code for color
'.BackColor = vbYellow

.GridFontColor = &HFF&
.GridLinesColor = &H0&
.TitleFontColor = &HFF0000
.DayFont.Name = "Times New Roman"
.GridFont.Name = "Arial"
.DayFont.Bold = True
End With
End Sub

--
Regards,

OssieMac


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Writing VBA Routine in XL2007 to run on XL2002


I hope that you get it working now John. I tested the code I gave you and it
all worked. I am using xl2007 with OS Windows Vista Home Premium.

Your question. "Is there any problems running either v10 or v11 of mscal.ocx
with the 2007 version of VBA?" I don't know the answer to that one.


--
Regards,

OssieMac


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
XL2002 SUM with a twist... Trevor Williams Excel Worksheet Functions 4 December 9th 09 10:28 AM
XL2002 - I'm having a bad day! Trevor Williams Excel Programming 3 October 20th 08 03:19 PM
xl2002 problem Gary Keramidas Excel Programming 3 May 24th 07 04:18 AM
Need help writing a filtering routine 39N 95W Excel Programming 1 January 13th 06 11:23 PM
Using min and max function XL2002 Extremely Aggravated Excel Worksheet Functions 1 September 23rd 05 06:29 PM


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