ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User Form Date Field disappeared! (https://www.excelbanter.com/excel-programming/440866-user-form-date-field-disappeared.html)

Ron Rosenfeld

User Form Date Field disappeared!
 
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

Rick Rothstein

User Form Date Field disappeared!
 
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 (MVP - Excel)



"Ron Rosenfeld" wrote in message
...
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



Ron Rosenfeld

User Form Date Field disappeared!
 
On Sun, 21 Mar 2010 16:07:04 -0400, "Rick Rothstein"
wrote:

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 (MVP - Excel)


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

Rick Rothstein

User Form Date Field disappeared!
 
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.

--
Rick (MVP - Excel)


Ron Rosenfeld

User Form Date Field disappeared!
 
On Mon, 22 Mar 2010 09:49:40 -0400, "Rick Rothstein"
wrote:

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.


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

Peter T

User Form Date Field disappeared!
 
Which version of Mscomct2.ocx do you have, which contains the DTPicker. If
not 6.1.98.16 see here and install the latest

http://support.microsoft.com/kb/957924

Regards,
Peter T

"Rick Rothstein" wrote in message
...
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.

--
Rick (MVP - Excel)




Ron Rosenfeld

User Form Date Field disappeared!
 
On Mon, 22 Mar 2010 19:22:20 -0000, "Peter T" <peter_t@discussions wrote:

Which version of Mscomct2.ocx do you have, which contains the DTPicker. If
not 6.1.98.16 see here and install the latest

http://support.microsoft.com/kb/957924

Regards,
Peter T


I have an older version of that file. OTOH, my OS is not listed in the
"applies to" portion of the MSKB article.
--ron

Peter T

User Form Date Field disappeared!
 
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

"Ron Rosenfeld" wrote in message
...
On Mon, 22 Mar 2010 19:22:20 -0000, "Peter T" <peter_t@discussions wrote:

Which version of Mscomct2.ocx do you have, which contains the DTPicker. If
not 6.1.98.16 see here and install the latest

http://support.microsoft.com/kb/957924

Regards,
Peter T


I have an older version of that file. OTOH, my OS is not listed in the
"applies to" portion of the MSKB article.
--ron




Ron Rosenfeld

User Form Date Field disappeared!
 
On Tue, 23 Mar 2010 09:09:07 -0000, "Peter T" <peter_t@discussions wrote:

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

Peter T

User Form Date Field disappeared!
 
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

"Ron Rosenfeld" wrote in message
...
On Tue, 23 Mar 2010 09:09:07 -0000, "Peter T" <peter_t@discussions wrote:

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




Ron Rosenfeld

User Form Date Field disappeared!
 
On Tue, 23 Mar 2010 11:34:32 -0000, "Peter T" <peter_t@discussions wrote:

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


All times are GMT +1. The time now is 02:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com