locked
Macro works in Win7 but not in Win10 RRS feed

  • Question

  • I am using Excel 2010 with Win 10 OS

    My company is migrating to Windows 10. Both of these options Edward provided below work in Windows 7, but when I try to run them in Win 10. I get a Object Required error. My understanding doesn't go that deep, but I wouldn't think the OS would matter in this case. I wasn't part of setting up the OS instances, but I would assume they are making them compatible in order migrate 2,000 users from Win 7 to Win10.  

    Any thoughts?

    Answer from Edward z

    'remove set for non-object
    Sub test()
        
    Dim daStart As Date
         daStart
    = Worksheets("SingleRecord").Range("I1")
    End Sub
    'change Date type to Range Object
    Sub test1()
        
    Dim daStart As Range
        
    Set daStart = Worksheets("SingleRecord").Range("I1")
    End Sub


    Michael Morgan

    Friday, July 1, 2016 5:41 AM

Answers

  • Hi Michael,

    Do you mean you will use textbox instead of Date Picker?

    I made a test with your description, and I agree with you, your issue is caused by that Microsoft Date and Time Picker Control 6.0 is not exist. It seems we need to register MSCOMCT2.CAB. But I failed to find a Microsoft site to download it. It seems available in Excel 2013, I suggest you make a try with Excel 2013.

    For another way, I would suggest you create your own Date Picker activeX control, and register it if you can’t use third party apps. You could refer the link below:

    # How to develop and deploy ActiveX control in C#

    https://blogs.msdn.microsoft.com/asiatech/2011/12/05/how-to-develop-and-deploy-activex-control-in-c/

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Marked as answer by m3looper Monday, July 4, 2016 10:13 PM
    Monday, July 4, 2016 5:37 AM

All replies

  • The code looks OK, and it works perfectly fine for me on Windows 10 (provided that my workbook has a worksheet named SingleRecord). The problem must be somewhere else in your code.

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Friday, July 1, 2016 9:28 AM
  • The statements are correct and should work in both OS.

    Are you sure you have a worksheet named SingleRecord on the PC you are testing with Windows 10? That's the only way your macro would fail.

    Also, when you are testing, is the active workbook the one that contains the worksheet SingleRecord?


    http://www.ambienteoffice.com.br - http://www.clarian.com.br

    Friday, July 1, 2016 9:30 AM
  • Yes I copy the file over to Win 10 so everything is there. Yes Active workbook does have SingeRecord worksheet.

    I am using Microsoft Date and Time Picker Control 6.0 (SP4) on the worksheet to push the date to cell I1. At one point I read something about it being  incompatible with Win 10, but then when I tried to do a search I couldn't find anything referencing that. The cell I1 is just a date field so I didn't think the Picker Control mattered. This afternoon I will try pulling that out and see if that works.


    Michael Morgan

    Friday, July 1, 2016 3:17 PM
  • Maybe your Office is 64 bits. If it is the case, this could explain the error.

    Could you check if your Office is 64 bits?


    http://www.ambienteoffice.com.br - http://www.clarian.com.br

    Friday, July 1, 2016 5:24 PM
  • Both are 32 bit.

    Michael Morgan

    Friday, July 1, 2016 7:17 PM
  • I removed the Microsoft Date and Time Picker Control 6.0 (SP4) from the SingleRecord sheet and the Private Sub that pushed the date to I1 and it ran fine.

    Private Sub DTPickStart_Change()
        Worksheets("SingleRecord").Range("I1").Value = Me.DTPickStart.Value
    End Sub

    Not sure what to replace it with, I checked and the Win 10 doesn't seem have this control available.

    I need a control on the sheet so I can keep it in one place regardless of how the single record gets displayed. I will do more research on the this Date Picker Control.    


    Michael Morgan


    • Edited by m3looper Friday, July 1, 2016 8:05 PM
    Friday, July 1, 2016 7:30 PM
  • See this:

    http://www.rondebruin.nl/win/addins/datepicker.htm


    http://www.ambienteoffice.com.br - http://www.clarian.com.br

    Friday, July 1, 2016 7:58 PM
  • Thanks at first glance this looks like it would work, but third party apps are not encourage due to security and maintenance issues. I need to find something that is a part of Excel.


    Michael Morgan

    Friday, July 1, 2016 9:02 PM
  • I did more research and the Date Picker is not well supported by Microsoft. The Text box works with both Win 7 and Win 10, so it will have to do given I can't use third party apps.

    Thank you all for your help.


    Michael Morgan

    Saturday, July 2, 2016 5:49 AM
  • Hi Michael,

    Do you mean you will use textbox instead of Date Picker?

    I made a test with your description, and I agree with you, your issue is caused by that Microsoft Date and Time Picker Control 6.0 is not exist. It seems we need to register MSCOMCT2.CAB. But I failed to find a Microsoft site to download it. It seems available in Excel 2013, I suggest you make a try with Excel 2013.

    For another way, I would suggest you create your own Date Picker activeX control, and register it if you can’t use third party apps. You could refer the link below:

    # How to develop and deploy ActiveX control in C#

    https://blogs.msdn.microsoft.com/asiatech/2011/12/05/how-to-develop-and-deploy-activex-control-in-c/

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Marked as answer by m3looper Monday, July 4, 2016 10:13 PM
    Monday, July 4, 2016 5:37 AM
  • Yes I did use a textbox and it works fine for both. Thank you for the link. For now I will see if we can live with the Textbox option, before looking at creating my own date picker.

    We are going to Windows 365 next year, so I will need to start working with that soon.

    Thanks again for the help. 


    Michael Morgan

    Monday, July 4, 2016 10:25 PM
  • I have registered on MSCOMCT2.CAB. Still not able to generate the sql script using MACROS in windows 10 and my Microsoft excel version is 2016. Please help  me on this as soon as possible

    • Edited by Codding Thursday, February 28, 2019 12:34 PM
    Thursday, February 28, 2019 12:30 PM
  • Getting below error while generating sql script:

    Invalid procedure call or argument.

    But if i change the 'date' to 'char' then it will generate successfully.

    I am not getting permanent solution on this. Could anyone help on this.


    • Edited by Codding Thursday, February 28, 2019 1:14 PM
    Thursday, February 28, 2019 1:12 PM