Results 1 to 8 of 8
  1. #1
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,420
    Thanks
    124
    Thanked 5 Times in 5 Posts

    code not working in Office 64

    I recently moved from office 32 bit to 64 bit

    The following code is not longer working


    Code:
     Sub showCalendar()         
    
    Dim hwnd As Long
    
    
    Dim zRect As RECT                               
     hwnd = FindWindow("XLMAIN", Application.Caption)
       'Get handle id of main Excel window.
    GetWindowRect hwnd, zRect          
    
    [dateCell].Select                           
    
    formCalendar.Left = zRect.Left                      'shows the Form on same screen as Excel's
    formCalendar.Show                                   'display Form
    
    End Sub

    It would be appreciated if someone could assist
    Last edited by HowardC; 2016-04-12 at 09:56.

  2. #2
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,820
    Thanks
    133
    Thanked 481 Times in 458 Posts
    Hi Howard

    Try this..
    Code:
    Sub showCalendar()         
    
    [dateCell].Select                           
    
    With formCalendar
      .StartUpPosition = 0
      .Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)
      .Top = Application.Top + (0.5 * Application.Height) - (0.5 * .Height)
      .Show
    End With
    
    End Sub
    zeddy

  3. #3
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,420
    Thanks
    124
    Thanked 5 Times in 5 Posts
    Hi Zeddy

    Thanks for the help. When Activating the Calendar, I now get the following error pertaining to the code below

    "Compile error: member or data member not found"

    Code:
     Private Sub UserForm_Initialize()
    
    zDate = [dateCell]
    If IsDate(zDate) Then
    Me.MonthView1.Value = zDate
    Else
    Me.MonthView1.Value = Date
    End If
    
    End Sub

    It would be appreciated if you could assist in resolving this

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    The MonthView control is not 64bit compatible so will have been removed from your form - you should have seen a warning message.
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,420
    Thanks
    124
    Thanked 5 Times in 5 Posts
    Thanks Rory. I will remove this

    Hopefully, I will not have too many compatibility issues with any of my workbooks, otherwise will move back to 32 bit

  6. #6
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,420
    Thanks
    124
    Thanked 5 Times in 5 Posts
    Hi Zeddy

    When you have a chance, kindly amend the code which you wrote a while back so that it is compatible with 64 Bit office so that I can access the calendar

    Many Thanks


    Howard
    Attached Files Attached Files
    Last edited by HowardC; 2016-04-13 at 14:23.

  7. #7
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,820
    Thanks
    133
    Thanked 481 Times in 458 Posts
    Hi Howard

    ..as rory says, "The MonthView control is not 64bit compatible".
    It's not a case of amending my code.
    It's because Microsoft doesn't have any 64-bit version of the calendar control.
    And if Microsoft doesn't have one, I don't feel like creating a 64-bit one for them.

    You could use three dropdowns to select day, month, year etc etc
    Then you could use Data Validation on the [dateCell] to make sure any entered date is valid.

    zeddy

  8. #8
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,420
    Thanks
    124
    Thanked 5 Times in 5 Posts
    Thanks for your input Zeddy

    I will set up dropdowns and then use data validation


    Howard

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •