User Form Date Field disappeared!

R

Ron Rosenfeld

I have an Excel workbook that I have been using for 6-7 years, initially in
Excel 2003; and more recently in Excel 2007 (where it is saved as an .xlsm
file).

There is a user form to enter data, and one of the pieces of data is a Date. I
could either enter the date directly, or select the different sections (M/D/Y)
and use up/down arrows to change the date. I don't recall how I set this up
initially.

I copy this file back and forth between two different machines -- a Windows XP
machine; and a Windows 7 machine.

Today I opened it on the Windows 7 machine, and the Date field on the user form
was gone!

The code is still there. It merely sets the initial value to today. FirstRun
is a variable that gets set to TRUE by UserForm_Initialize

========================
Private Sub Dt_Enter()
If FirstRun = True Then
Dt.Value = Int(Now())
FirstRun = False
End If
End Sub
======================

Why did the Date field disappear?

How did I set this up in the first place?

Thanks.
--ron
 
R

Rick Rothstein

It almost sounds like you are describing the DatePicker control. While I'm
not sure why it went away, I do remember that it is not a native Windows
control; rather, it came with the compiled version of Visual Basic (Common
Controls as I remember) and would be available on your system if you
installed VB5 or VB6 or installed any program that relied on the VB5 or VB6
runtime DLL. Perhaps one of your computers doesn't have the DatePicker
control available and the Reference to it was lost? You could try checking
the References for the project and see if it is available or not and, if
not, try to activate the reference to it.
 
R

Ron Rosenfeld

It almost sounds like you are describing the DatePicker control. While I'm
not sure why it went away, I do remember that it is not a native Windows
control; rather, it came with the compiled version of Visual Basic (Common
Controls as I remember) and would be available on your system if you
installed VB5 or VB6 or installed any program that relied on the VB5 or VB6
runtime DLL. Perhaps one of your computers doesn't have the DatePicker
control available and the Reference to it was lost? You could try checking
the References for the project and see if it is available or not and, if
not, try to activate the reference to it.

Rick,

After I posted that I realized that it was the DatePicker control. I had
thought that to be the case, but initially could not find it.

And I think you're correct about it being a reference problem, possibly due to
the fact that my XP machine is 32 bit and the W7 machine is 64 bit. I'm
thinking this because when I finally located the reference containing the
DatePicker control on my W7 machine, it has a "64" in the pathname:
C:\Windows\SysWOW64\mscomct2.ocx

I believe that file is in the Windows\System32 folder on an XP machine (at
least it is on the XP Virtual Machine that I have on my W7-64 computer.

Interesting gotcha.

Thanks.
--ron
 
R

Rick Rothstein

I believe that file is in the Windows\System32 folder on an XP machine (at
least it is on the XP Virtual Machine that I have on my W7-64 computer.

Really? Do you have to do something to activate it? When I installed Vista
on my computer a few months ago, (I could be wrong about this... old age and
all<g>) I am almost positive that I looked to see if I could add the
DatePicker control to a UserForm and couldn't until after I installed my
copy of the compiler version of VB6.
 
R

Ron Rosenfeld

Really? Do you have to do something to activate it? When I installed Vista
on my computer a few months ago, (I could be wrong about this... old age and
all<g>) I am almost positive that I looked to see if I could add the
DatePicker control to a UserForm and couldn't until after I installed my
copy of the compiler version of VB6.

Well, I definitely did not install VB6.

In W7, the Date/Time picker did not appear initially on the VBA userform
ToolBox. But when I right-clicked on the toolbox, and selected the option to
add more controls, in the drop down list (once I finally found it) there was an
entry for "Microsoft Date and Time Picker Control 6.0(SP4)"

I've never had a Vista machine.
--ron
 
P

Peter T

As you say, x64 is not included in the list of OS. I am surprised though,
AFAIK the VB6 runtime files are the same in 32 & 64 bit systems, although
not all of the files will work in x64, maybe that's why x64 is not listed.

However if your version of the control is older that might be the reason
it's not working, typically that's the explanation in other OS.

One thing though, I think most if not all those ActiveX controls will fail
to work in 64 bit Office, if that's what you have.

Regards,
Peter T
 
R

Ron Rosenfeld

As you say, x64 is not included in the list of OS. I am surprised though,
AFAIK the VB6 runtime files are the same in 32 & 64 bit systems, although
not all of the files will work in x64, maybe that's why x64 is not listed.

However if your version of the control is older that might be the reason
it's not working, typically that's the explanation in other OS.

One thing though, I think most if not all those ActiveX controls will fail
to work in 64 bit Office, if that's what you have.

Regards,
Peter T

My control *IS* older (6.00?) and *IS* working. I believe it was just in a
different directory on my W7-64 machine than on the XP-32 machine.
--ron
 
P

Peter T

OK I misunderstood, I didn't realise the control is working. However, AFAIK,
the path of a registered control should not be relevant(though the VB
controls would normally be in the relevant system folder).

Regards,
Peter T
 
R

Ron Rosenfeld

OK I misunderstood, I didn't realise the control is working. However, AFAIK,
the path of a registered control should not be relevant(though the VB
controls would normally be in the relevant system folder).

Regards,

I would have thought that to be the case also. After all, an Excel project
should be able to be transported from a 32 to a 64 bit OS and still work.

It didn't happen here.

There could be some other issue going on other than the control being in a
different folder. But, since it's working for me now, I'm not inclined to
investigate further.
--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top