From: Ron Rosenfeld on 21 Mar 2010 15:37 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
From: Rick Rothstein on 21 Mar 2010 16:07 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" <ronrosenfeld(a)nospam.org> wrote in message news:7gscq5tanm8jh5o31vss1gh5fd2gvo3l9i(a)4ax.com... > 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
From: Ron Rosenfeld on 21 Mar 2010 16:56 On Sun, 21 Mar 2010 16:07:04 -0400, "Rick Rothstein" <rick.newsNO.SPAM(a)NO.SPAMverizon.net> 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
From: Rick Rothstein on 22 Mar 2010 09:49 > 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)
From: Ron Rosenfeld on 22 Mar 2010 12:46
On Mon, 22 Mar 2010 09:49:40 -0400, "Rick Rothstein" <rick.newsNO.SPAM(a)NO.SPAMverizon.net> 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 |