Dave T
03-20-2011, 05:16 PM
Hello All,
I have recently purchased a Holy Macro book called "Office VBA - Macros you can use today (http://www.mrexcel.com/officevba.html)".
My apologies for cross posting this message, but as it the book was published by Holy Macro (MrExcel) I thought I should first ask my question in the MrExcel message board (link (http://www.mrexcel.com/forum/showthread.php?t=532824)).
However as VBA Express has a dedicated Word forum, I felt this might be a more appropriate site to pose these questions.
I have been looking at the topic/macro called "Using Calendar Control for Office Applications" which has a non ActiveX calendar.
Due to possible copyright issues I did not want to post any of the code in a web forum.
I would like to be able to use this within a Word document that has been set up as a 'Form' using form fields.
I have added the "ShowForm" macro to the 'Run macro on entry box' within the 'Text Form Field Options', which pops up the calendar when an appropriate field is selected.
There are two things I have yet to work out...
How to get the selected calendar date to be returned into the selected form field. The macro works great when in a normal document but not within a protected form.
When using the calendar on a normal document the date is returned in the default format of d/mm/yyyy and I would like to be able to modify this so the date can be returned in another format e.g. dd-MMM-yy or dddd, dd MMM yyyy, etc.I have been looking at various web sites that look at calendars…
Graham Mayor
Use a pop-up calendar to select and insert a date
http://www.gmayor.com/popup_calendar.htm
Martin Green
A Pop-up Calendar for Word - Part 1: A Simple Calendar
http://www.fontstuff.com/word/wordtut03a.htm
A Pop-up Calendar for Word - Part 2: Customizing the Calendar
http://www.fontstuff.com/word/wordtut03b.htm
I Want the Calendar to Open Automatically When the User Enters a Form Field
http://www.fontstuff.com/mailbag/qword01.htm
When the calendar is used on a normal document and the user clicks OK the date selected on the calendar is returned to the insertion point selected on the document.
Both Graham and Martin mention that extra coding needs to be done to the macro to enable it to be used with a protected form, one even suggests recreating another version of the initial code and modifying this for use within a form.
The calendar UserForm has an OK button, which when selected returns the selected date, but this does no work when used on a protected ‘form’ section of a document.
I was wondering if it was possible to just add another button the UserForm (called something like ‘Form OK’) that would enable the selected date to be returned to a form field within the protected section.
My other question is whether the macro would need to be coded with the type of date format returned or would this be done by selecting the ‘Text Form Field Options’ to ‘Date’ and creating a date format.
If this was possible then the date returned would not require any macro coding.
Any help or comments would be appreciated.
Regards,
Dave T
I have recently purchased a Holy Macro book called "Office VBA - Macros you can use today (http://www.mrexcel.com/officevba.html)".
My apologies for cross posting this message, but as it the book was published by Holy Macro (MrExcel) I thought I should first ask my question in the MrExcel message board (link (http://www.mrexcel.com/forum/showthread.php?t=532824)).
However as VBA Express has a dedicated Word forum, I felt this might be a more appropriate site to pose these questions.
I have been looking at the topic/macro called "Using Calendar Control for Office Applications" which has a non ActiveX calendar.
Due to possible copyright issues I did not want to post any of the code in a web forum.
I would like to be able to use this within a Word document that has been set up as a 'Form' using form fields.
I have added the "ShowForm" macro to the 'Run macro on entry box' within the 'Text Form Field Options', which pops up the calendar when an appropriate field is selected.
There are two things I have yet to work out...
How to get the selected calendar date to be returned into the selected form field. The macro works great when in a normal document but not within a protected form.
When using the calendar on a normal document the date is returned in the default format of d/mm/yyyy and I would like to be able to modify this so the date can be returned in another format e.g. dd-MMM-yy or dddd, dd MMM yyyy, etc.I have been looking at various web sites that look at calendars…
Graham Mayor
Use a pop-up calendar to select and insert a date
http://www.gmayor.com/popup_calendar.htm
Martin Green
A Pop-up Calendar for Word - Part 1: A Simple Calendar
http://www.fontstuff.com/word/wordtut03a.htm
A Pop-up Calendar for Word - Part 2: Customizing the Calendar
http://www.fontstuff.com/word/wordtut03b.htm
I Want the Calendar to Open Automatically When the User Enters a Form Field
http://www.fontstuff.com/mailbag/qword01.htm
When the calendar is used on a normal document and the user clicks OK the date selected on the calendar is returned to the insertion point selected on the document.
Both Graham and Martin mention that extra coding needs to be done to the macro to enable it to be used with a protected form, one even suggests recreating another version of the initial code and modifying this for use within a form.
The calendar UserForm has an OK button, which when selected returns the selected date, but this does no work when used on a protected ‘form’ section of a document.
I was wondering if it was possible to just add another button the UserForm (called something like ‘Form OK’) that would enable the selected date to be returned to a form field within the protected section.
My other question is whether the macro would need to be coded with the type of date format returned or would this be done by selecting the ‘Text Form Field Options’ to ‘Date’ and creating a date format.
If this was possible then the date returned would not require any macro coding.
Any help or comments would be appreciated.
Regards,
Dave T