Vba word нет календаря

RRS feed

  • Remove From My Forums
  • Question

  • Hi, 

    I have a form that I have been using a monthview for the calendar.  We are moving to Office 2016 and it appears this is no longer an option. Has anyone found a solution for this? 

    thanks

All replies

  • I have a form that I have been using a monthview for the calendar.  We are moving to Office 2016 and it appears this is no longer an option. 

    Which software do you use a «monthview» for the calendar?
    Is it Microsoft Word, its version is older than 2016? 

    • Edited by

      Sunday, October 23, 2016 10:40 PM

  • I’m afraid Office 2016 does not have an adequate controls we want.

    With Office 2013 and 2010, we can add «Date and Time Picker Control» in User Form.
    But we can NOT with Office 2016.

    I’ve tried to use «Outlook Date Control» with Word/Excel 2016, in vain.
    An error occurs in Run time. It says «Interface not supported» (originally in Japanese).

    [note]
     In order to add controls, 
     1. on Menu in VBE screen, select [Tools] > [Additional Controls]
        
     2. select 
          a) in case of Office 2010: [Microsoft Date and Time Picker Control…]
          b) in case of Office 2016: [Microsoft Outlook Date Control]
        

    Regards,
    Ashidacchi

  • Hi JJB Consulting,

    you can try to use Microsoft Date Time Picker Control from Additional Controls option in toolbox.

    I try to test this Control in Word 2016 and it is working correctly. check the output mentioned below.

    Demo Example Code:

    Private Sub CommandButton1_Click()
    Label1.Caption = DTPicker1.Value
    End Sub
    

    Regards

    Deepak


    MSDN Community Support
    Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
    MSDN Support, feel free to contact MSDNFSF@microsoft.com.

  • Hi Deepak Panchal10,

    Which version and build of Office have you used?
    I suppose you’re using older than Office 2016, such as 2013, 2010.

    I could not find «Microsoft Date and Time Picker Control 6.0» in Office 2016.
        
    I’m using Office Pro.Plus 2016:
       Version 1609 (Build 7369.2038)
        

    Office 2010: Microsoft Date and Time Picker Control 6.0 can be seen.
        

    • Edited by
      Ashidacchi
      Monday, October 24, 2016 3:09 AM

  • Hi Ashidacchi,

    below is the version and build information that you had asked.

    It is using MS Office 2016.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
    MSDN Support, feel free to contact MSDNFSF@microsoft.com.

  • Hi Deepak Panchal10,

    Thank you for information.
    Your screenshot shows «Office 365», instead of «Office 2016».

    If you’re using «Office 2016», which package did you use as an installer, ClickOnce or MSI?

    # I installed Office 2016 via ClickOnce.

    • Edited by
      Ashidacchi
      Tuesday, October 25, 2016 2:35 AM

  • Hi Ashidacchi,

    we have subscription of Office 365 on Office 2016.

    I don’t know by which way they installed because it’s not our responsibility to install these products.

    it all handles by other It Team who look after and take care about this.

    All I can say that it is Office 2016. you can check the information mentioned in the picture.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
    MSDN Support, feel free to contact MSDNFSF@microsoft.com.

  • Hi Deepak Panchal10,

    Thank you for information again.

    May I ask you to try to update your Office?
    My Office 2016 is build 7369.2037 and yours 7369,2017.

    I’ve heard a several troubles in the latest build of Office 2016, expecially Excel 2016.

  • Hi Ashidachhi,

    currently I have to check and test many codes on multiple Ms Office Applications.

    so I am unable to update the MS Office currently.

    I can try for that after work.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
    MSDN Support, feel free to contact MSDNFSF@microsoft.com.

  • Hi Deepak Panchel10,

        Thanks a lot.
        I hope you will be able to update your MS Office 2016 and to reproduce the issue of JJB consulting and me.

    Hi JJB consulting,

        How is your issue?  Have you found any resolution?
        I would like to see your «Additional Controls» screen.
        Could you insert a screenshot? or share it via cloud storage such as OneDrive, DropBox?

    Regards,
    Ashidacchi 

    • Edited by
      Ashidacchi
      Tuesday, October 25, 2016 4:27 AM

  • Hi Ashidachhi,

    I update my MS Office 2016 with latest available updates.

    you can see the new version in the picture mentioned below.

    and I find that Microsoft Date and Time Picker is still there and I can use it.

    maybe there is some issue with your MS Office and I hope that op also have this control in his MS Office Application and can able to use it to fulfill his requirement.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
    MSDN Support, feel free to contact MSDNFSF@microsoft.com.

  • Hi Deepak,

    Thank you for infomation.

    According to your description, there exist some differences between you and me.

    1. You have subscription of Office 365 and use it.
        (I have that of MSDN. So I suppose I could use Office 365, but I have not used it. I’ll try to use it.)

    2. The version of Office 2016/365:
         yours: 1610 (Build 7466.2022)
         mine: 1609 (Build 7369.2038)

         My Office 2016 cannot be updated further, i.e. it’s the latest in my case.
        

    3. My Office 2016 is Japanese version originally. And I’ve added the Language Pack of English.
      

    Regards,
    Ashidacchi

    • Edited by
      Ashidacchi
      Thursday, October 27, 2016 3:30 AM

  • Hi Ashidachhi,

    Note. If the Microsoft Date Piker control is not available in the
    More Controls list, it’s most likely because of the following reasons:

    • You are using the 64 bit version of Office. Regrettably, there is no official date picker control for
      Office64-bit. The only solution is using a third-party calendar for Excel.
    • The calendar control (mscomct2.ocx) is not available or is not registered on your machine. To fix this, please follow these instructions: How to register the calendar control.

    The Date and Time Picker is part of a library of tools with the catchy title  of
    MSCOMCT2.OCX

    if you are using the Office 2016 32 bit version and Microsoft Date time Picker is not available then you can download the MSCOMCT2.OCX from the link mentioned below.

    Download MSCOMCT2.OCX

    please visit the link mentioned below to view the steps to install above mentioned library.

    Installing the Date and Time Picker Control for VBA

    it looks like you are using Office 2016 64 bit version.

    -> if you are using 64 bit version then you can try to use third party Calendar control. so many Calendar controls are available on the internet. you can try to find.

    Regards

    Deepak 


    MSDN Community Support
    Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
    MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by
      Ashidacchi
      Friday, October 28, 2016 1:54 AM

  • Hi Deepak and JJB consulting,

    Deepak, I appreciate your spending much time.
    I’ve got it. I could use Date and Time Picker control.

    my environment:
      Windows 10 [64-bit]
      Office 2016 [32-bit]

      
    I did this:
    1. download «MSCOMCT2.OCX»
    2. copy it to «C:%windows%SysWOW64» folder
    3. run cmd.exe
      3.1. change current directory to «C:%windows%SysWOW64»
      3.2. type «regsvr32 mscomct2.ocx» and [Enter]
    4. reboot Windows

    I hope JJB consulting will do like me and will be able to use Date and Time Picker control, according to his/her environment[*1].

    [*1] 
      If using 64-bit version of Windows, do what I did.
      If using 32-bit version of Windows, do below.
        1. download «MSCOMCT2.OCX»
        2. copy it to «C:%windows%SysWOW64» folder
        3. run cmd.exe
           3.1. change current directory to «C:%windows%SysWOW64»
           3.2. type «regsvr32 mscomct2.ocx» and [Enter]
        4. reboot Windows

    Best regards,
    Ashidacchi

  • Hi
    Ashidacchi,

    Glad to know that you are now able to use Microsoft Date Time Picker Control in Office 2016.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click «Mark as Answer» the responses that resolved your issue, and to click «Unmark as Answer» if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
    MSDN Support, feel free to contact MSDNFSF@microsoft.com.

0 / 0 / 0

Регистрация: 05.05.2013

Сообщений: 189

1

Отсутствует Календарь

16.05.2013, 14:05. Показов 4855. Ответов 4


Студворк — интернет-сервис помощи студентам

Помогите добавить календарь в форму. В Toolbox он отсутствует, даже в доп. формах. Где его взять?



0



Programming

Эксперт

94731 / 64177 / 26122

Регистрация: 12.04.2006

Сообщений: 116,782

16.05.2013, 14:05

4

Апострофф

Заблокирован

16.05.2013, 14:58

2

Tools -> Additional Controls… -> Microsoft Data and Time Picker Control



0



0 / 0 / 0

Регистрация: 05.05.2013

Сообщений: 189

16.05.2013, 15:28

 [ТС]

3

Цитата
Сообщение от Апострофф
Посмотреть сообщение

Tools -> Additional Controls… -> Microsoft Data and Time Picker Control

Отсутствует данная форма в настройках((



0



Апострофф

Заблокирован

16.05.2013, 15:37

4

Возможно, надо найти и зарегистрировать подчеркнутую библиотеку?

Миниатюры

Отсутствует Календарь
 



1



5468 / 1148 / 50

Регистрация: 15.09.2012

Сообщений: 3,514

16.05.2013, 15:38

5

adlansuliman, есть 2 вида календарей от Microsoft и все эти календари продаются только с программой «Access». Если на компьютере не установлена программа «Access», то календаря не будет.

Нужно где-то в интернете искать файл, в котором есть календарь.



1



IT_Exp

Эксперт

87844 / 49110 / 22898

Регистрация: 17.06.2006

Сообщений: 92,604

16.05.2013, 15:38

Помогаю со студенческими работами здесь

календарь
Приветствую всех!) может мне кто нибудь предоставить исходник календаря? очень нужно… буду очень…

Календарь
#!/usr/bin/perl -w

my ($a, $b, $c, $chislo, $f, $k, $nedelya, $g, $x) = localtime();

my…

календарь
Даны натуральные числа А,В, С, которые обозначают число, месяц и год. Получить тройку чисел,…

Календарь
Можно ли програмно узнать какой сейчас месяц, сколько в нем дней и какие из этих дней выходные?

Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:

5

Date Picker Calendar in Excel VBA

Oftentimes, users want to click a button and select a date. This is no different for Excel developers. Check out this ActiveX control by Microsoft that allows users to do just that. It’s a little old school looking, but actually has quite a nice feel to it.

Start by creating a userform and enabling the control by Right-clicking on the Tools menu and click Add additional tools

Now, let’s add this to the userform!

Calendar In Excel using Microsoft MonthView Control

In the downloadable workbook, you’ll see the control was renamed to ‘fCal’. When you double-click the control you’ll see the following code which is the DateClick event of that control:

code snippet

This userform cleverly has two labels to store relevant info on the Userform that summoned it. 1.) The name of the userform that called it and 2.) The name of the control or textbox that needs the date sent to it.

Then, this code above loops through all userforms in your project until it finds one that matches the label for the Userform (lblUF) and the label for the textbox needed (lblCtrlName).

Also, you may need to enable Microsoft Windows Common Controls -2 6.0 (SP6) by using Tools->References and clicking:

s

Stop Wasting Your Time

Experience Ultimate Excel Automation & Learn to “Make Excel Do Your Work For You”

s

Watch Us Make a Calendar In Excel On YouTube:

This website uses cookies to improve your experience. We’ll assume you’re ok with this, but you can opt-out if you wish. Cookie settingsACCEPT

Wait A Second!

Thank you for visiting! Here’s a FREE gift for you!

Enroll In My FREE VBA Crash Course For FREE!

Learn how to write macros from scratch, make buttons and simple procedures to automate tasks.

Excel vba календарь

Выпадающий календарь для ввода дат

Наша задача — добавить в книгу Excel пользовательскую форму (окно) с автоматическим календарем. Вот такое:

Окошко будет появляться при нажатии сочетания клавиш и после выбора в нем нужной даты — она попадает в текущую ячейку листа. Просто и красиво!

Откройте редактор Visual Basic через меню Сервис — Макрос — Редактор Visual Basic (Tools — Macro — Visual Basic Editor).

Создайте в нем новую пустую пользовательску форму, выбрав в меню Insert — User form .

Автоматически должна появиться панель Toolbox :

Если не появилась — жмите в меню View — Toolbox .

На этой панели представлены различные управляющие элементы окон: кнопки, списки, счетчики и т.д. Но нам нужен элемент (календарь), которого пока на панели не видно. Чтобы добавить его, щелкните по серому фону панели правой кнопкой мыши и выберите Additional Controls . Появится вот такое окно:

В нем надо найти и отметить Элемент управления Календарь 11.0 (Calendar Control 11.0). Версии могут отличаться (11.0, 10.0 и т.д.) в зависимости от версии Microsoft Office, это несущественно. После нажатия на ОК на панели появится новая кнопка — Calendar :

Щелкните по ней, а затем нарисуйте календарь на поле формы, удерживая нажатой левую кнопку мыши:

При желании подправьте размеры формы и календаря и введите текст заголовка окна в панели свойств слева.

Теперь переключитесь в режим ввода программного кода созданной формы (меню View — Code ) и скопируйте туда этот текст:

Private Sub Calendar1_Click()
ActiveCell = Calendar1.Value
ActiveCell.NumberFormat=»dd/mm/yy»
End Sub

Private Sub UserForm_Activate()
Me.Calendar1.Value = Date
End Sub

Теперь надо заставить Excel показывать нам созданную форму, когда мы этого захотим. Для этого вставьте новый модуль ( Insert — Module ) и скопируйте туда этот текст:

Sub ShowCalendar()
UserForm1.Show
End Sub

Осталось закрыть редактор Visual Basic и, вернувшись в Excel, назначить созданному макросу ShowCalendar любое подходящее сочетание клавиш (меню Сервис — Макрос — Макросы — кнопка Параметры ).

Если у Вас установлена не полная версия Office, то элемента управления Календарь может не оказаться в списке Additional Controls . Тогда скачайте этот файл (MSCal.ocx.zip) , поместите его в папку C:Windowssystem32 и зарегистрируйте новый элемент управления через меню Пуск — Выполнить , далее набрать Regsvr32 c:windowssystem32mscal.ocx и нажать ОК .

(За дополнение спасибо Vadim )

Если Вы хотите, чтобы календарь автоматически появлялся на экране, когда пользователь выделяет определенные ячейки (диапазон) на листе, то щелкните правой кнопкой мыши по ярлычку этого листа и выберите Исходный текст (View Source). В открывшееся окно редактора Visual Basic скопируйте следующий код:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Application.Intersect(Range(«A1:A20»), Target) Is Nothing Then
UserForm1.Show
End If
End Sub

Теперь при выделении любой ячейки из диапазона А1:А20 календарь будет автоматически отображаться на экране.

Всплывающий календарь

Если вам часто приходится вводить даты в ячейки листа, то делать это вручную неудобно. Для ввода именно сегодняшней даты можно воспользоваться функцией СЕГОДНЯ (TODAY), сочетанием клавиш Ctrl+; или макросом, но если нужны разные даты из прошлого или будущего, то вбивать их руками долго.

К сожалению, в стандартном арсенале средств Excel нет встроенного выпадающего календаря (в отличие от Word), да еще и в последних версиях, начиная с Excel 2007, Microsoft зачем-то убрала из стандартного комплекта поставки библиотеку mscalc.osx, которая позволяла быстро создать пользовательскую форму с календарем.

Естественно, это «узкое место» не осталось без внимания опытных пользователей и экспертов Excel MVP, которые оперативно создали несколько интерактивных календарей на макросах для удобного ввода дат. Вот подборка неплохих, на мой взгляд, бесплатных вариантов:

Windows Date Picker
Автор: Ron de Bruin
Цена: бесплатно
Ссылка

  • Устанавливается как надстройка (есть версии для старых Excel 200-2003 и для новых Excel 2007-2010 и, отдельно, для Excel 2013.
  • Вызывается через контекстное меню ячейки (правой кнопкой мыши по ячейке — Date Picker).
  • Позволяет вставлять дату в нескольких форматах, вплоть до номера недели (по разным стандартам).
  • Автоматически подстраивается под российский стандарт недели (с понедельника).
Excel Date Picker
Автор: Jim Cone
Цена: бесплатно
Ссылка

  • Макрос (не надстройка!) с открытым кодом VBA — можно посмотреть как всё устроено и модернизировать «под себя». Но надо копировать код в каждый используемый файл и вызывать нажатием на кнопку или сочетанием клавиш, т.е. универсальность хромает.
  • Удобная система прокрутки лет и месяцев.
  • Российскую неделю (с понедельника) знает.
  • Каких-либо настроек нет.
Mini Calendar and Date Picker
Автор: VERTEX
Цена: бесплатно.
Ссылка в Office Apps Store

  • Работает только в Excel 2013, добавляется через магазин приложений Office App Store на вкладке Вставка — Приложения для Office (Insert — Office Apps Store).
  • Вставляется на лист как постоянный графический объект и добавляет выбранную дату в любую выделенную предварительно ячейку.
  • Умеет менять стандарты недели, отображать номера недель, вводить не только дату, но и время.
  • Есть возможность задавать темы оформления.
  • Нет кнопки перехода к текущему дню.
Date Picker
Автор: Sam Radakovitz, руководитель команды программистов Excel в Microsoft
Цена: бесплатно
Сайт автора умер, ссылки не работают, но можно скачать заботливо сохраненную мной когда-то копию здесь.

  • Устанавливается как надстройка.
  • Вызывается через правую кнопку мыши по ячейке — Pick from calendar или с помощью удобного всплывающего значка календарика справа от ячейки с датой.
  • Красивый дизайн, отображение количества дней до выбранной даты от текущей.
  • Использует USA-стандарт недели (отображает неделю с воскресенья).
  • Настроек нет.
  • в Excel 2003 и старше — меню Сервис — Надстройки — Обзор (Tools — Add-ins — Browse)
  • в Excel 2007 и новее — Файл — Параметры — Надстройки — Перейти — Обзор (File — Options — Add-ins — Go To — Browse)

How to add Calendar, Date-Picker?

I need to add a Calendar Date Picker in Excel 2013.

I found that the MonthView and the DT Picker are no longer in the ActiveX menu and the links for a CAB file that supposedly contains these does not work. There are instruction documents, but they rely on a control that doesn’t exist.

I have an Excel Addin that does what I want, but I want to do this with VBA rather than install the Addin on every machine that will use this.

4 Answers 4

Once you have registered the mscomct2.ocx control (YOU WILL NEED TO REGISTER THIS FILE ON ALL COMPUTERS THAT WILL USE THIS WORKBOOK!), you can either add one of below controls in the Worksheet or in a UserForm:

  • Date and Time Picker (DTPicker), left/top of screenshots
  • MonthView, right/bottom of screenshots

WORKSHEET (ActiveX)

  1. In Developer tab, Controls group, click Insert, then bottom right button for More Controls.
  2. Scroll down and select Microsoft Date and Time Picker Control 6.0 (SP6) or Microsoft MonthView Control 6.0 (SP6) then click OK.
    |
  3. When you are out of Design Mode, clicking on the DTPicker control is like this, while the MonthView takes more space:
    |

UserForm

  1. In the Toolbox for the UserForm selected, right click on empty space of the Controls tab, click Additional Controls
  2. Scroll down and tick Microsoft Date and Time Picker Control 6.0 (SP6) or Microsoft MonthView Control 6.0 (SP6):
    |
  3. Now the controls are in your Controls tab to add on UserForms
  4. Default size of the controls on UserForm:

In either way, you will need to implement the actions when you click on these controls.

Excel vba календарь

На этом шаге мы рассмотрим основные свойства и методы этого элемента управления .

Среди дополнительных элементов управления очень полезным является элемент управления Calendar (Календарь) (рисунок 1).

Рис.1. Календарь на форме

Этот объект представляет средство для организации удобного интерфейса по вводу дат. Этот элемент управления располагается на форме с помощью кнопки Календарь (Calendar) .

Перечислим основные свойства элемента управления Calendar .

Свойство Назначение
Day Возвращает выбранный день
DayFont, DayFontColor Устанавливают шрифт и цвет шрифта для названий дней недели
DayLenght Допустимые значения:

  • Длинный (Long) (отображаются полные названия дней);
  • Средний (Medium) (в русской версии — отображаются две буквы из названий дней, в английской -три буквы);
  • Короткий (Short) (отображается только по первой букве из названия дня).

FirstDay Первый день недели. Допустимые значения от Воскресенье (Sunday) до Суббота (Saturday)
Month Возвращает выбранный месяц
MonthLenght Допустимые значения: Длинный (Long) (отображаются полные названия месяца) и Короткий (Short) (отображаются только первые три буквы из названия месяца)
ShowDays Допустимые значения: True (отображаются названия дней недели) и False (в противном случае)
ShowDataselected Допустимые значения: True (отображается выбранная дата в верхней части календаря) и False (в противном случае)
Value Возвращает выбранную дату
Year Возвращает выбранный год

Таблица 1. Основные свойства Calendar

Перечислим основные методы элемента управления Calendar .

Метод Назначение
NextDay, NextWeek, NextMonth и NextYear Устанавливает следующий день, неделю, месяц и год
PreviousDay, PreviousWeek, PreviousMonth и PreviousYear Устанавливает предыдущий день, неделю, месяц и год
Today Устанавливает текущую дату в календаре

Таблица 2. Основные методы Calendar

В качестве примера использования календаря приведем следующую процедуру, которая считывает из календаря выбранную дату и вводит ее в ячейку рабочего листа:

Результат работы процедуры приведен на рисунке 2.

Рис.2. Отображение выбранной даты в ячейке

На следующем шаге мы рассмотрим определение последовательности выбора элементов управления .

голоса

Рейтинг статьи

Оценка статьи:

2 звезды3 звезды4 звезды5 звезд5 звезд

Загрузка…

Похожие публикации

Adblock
detector

Вам когда-нибудь хотелось, чтобы в Вашем приложении Excel или в любом другом MS Office приложении можно было выбирать дату из календаря при вставке ее, например, в ячейку или на форму, а не вводить вручную. Такая возможность есть!

Я в своих приложениях везде использую такой календарь. Большое спасибо автору, который создал этот календарь. Код в некоторых местах я переписал, чтобы он был адаптирован под удобное использование во многих проектах. Можете скачать архив с Excel-книгой этого календаря. API для работы с календарем очень простое (посмотрите код рабочего листа, где используется обработчик события нажатия на кнопку).

Для работы с календарем в Вашем Excel-приложении Вам всего лишь нужно импортировать один модуль, два класса и форму календаря в Вашу Excel-книгу и прописать в любом Вашем модуле несколько строк API-кода для работы с календарем, и все. Пользуйтесь на здоровье!

Ссылка на архив с книгой Excel и модули календаря: Скачать из Яндекс.Диска

Понравилась статья? Поделить с друзьями:
  • Vba word найти таблицу с текстом
  • Vba word найти строку
  • Vba word название файла
  • Vba word на примерах
  • Vba word курсор в начало документа