Calender: Setting Start Day of Week
The calender on my Touch in the monthly view starts the week on a Monday, how do I change it to start on Sunday?
David
You can change the Locale of your application into your faces-config.xml file.
Here an example for FRENCH Locale:
<?xml version="1.0" encoding="windows-1252"?>
<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee">
<application>
<default-render-kit-id>oracle.adf.rich</default-render-kit-id>
<locale-config>
<default-locale>fr</default-locale>
</locale-config>
<resource-bundle>
</application>
</faces-config>
Hope this help
Jack
Similar Messages
-
Shading certain columns depending on start day of week.
Good Afternoon,
I have reason to edit the calendar wizard to make it completely automated. And before anyone says that this isn't used anymore, we've received 2 separate calendar files over the last made from our Finance departments, each making them with Word calendar
wizard highlighting year end dates. So believe me, the calendar wizard is still very much in use!
Last September, I finally figured out how to automate the first day of the week, though. I have 2 templates now, one for Monday as first day and one for Sunday being the first day of the week.
The only thing missing is to automate the shading so that the columns for Saturday and Sunday are shaded with light grey, and since it's automation we're talking about, only those cells in the columns with a number in them.
I know it's do-able, I'm just not a vb expert, only being able to handle editing simple macros.
But I understand that since I had some help with the macros and they might have changed from the original to some degree, that I should post the code. Is this correct? I hope that it is.
' WORD 97 WIZARD
' Calendar Wizard Specific Code
Option Explicit
' CONSTANT DECLARATIONS
'=============================== LOCALIZATION BLOCK ===============================
' Localization Note: iWeekStartDay is the starting day of the week (Sun = 0, Mon = 1, ...Sat = 6)
Public Const iWeekStartDay As Integer = 1
' Banter strings
Public Const strWarnYearReq As String = "Both starting and ending years are required."
Public Const strWarnMinExceeded As String = "The year can not be before 1900."
Public Const strWarnMaxExceeded As String = "The year can not be after 4095."
Public Const strWarnRangeExceeded As String = "The calendar is limited to 120 months (10 years)."
Public Const strAppCaptionPart1 As String = "Calendar: "
Public Const strAppCaptionPart1b As String = ""
Public Const strAppCaptionPart2 As String = ", "
Public Const strAppCaptionPart3 As String = " to "
Public Const strAppCaptionPart4 As String = ", "
' Status messages
Public Const strStatusIntro As String = "Creating Calendar..."
Public Const strStatusPart1 As String = "Creating "
Public Const strStatusPart2 As String = ", "
Public Const strStatusPart3 As String = "..."
' Assistant
Public Const strCallBackHeading As String = "Do more with the calendar?"
'Margins for A4 size (if wizard changes pagesize to A4)
Public Const sA4_SHORT_MARGIN As Single = 28.8
Public Const sA4_LONG_MARGIN As Single = 57.6
'Margins for Letter size (if wizard changes pagesize to Letter) in pts
Public Const sLETTER_SHORT_MARGIN As Single = 36
Public Const sLETTER_LONG_MARGIN As Single = 36
'========== END LOCALIZATION BLOCK - DO NOT MAKE CHANGES BELOW THIS LINE ==========
Public Const iYearMin As Integer = 1900
Public Const iYearMax As Integer = 4095
' Bookmark Names - DO NOT LOCALIZE
' Note: No spaces allowed in bookmark names
Public Const strBkMkMonth As String = "Month"
Public Const strBkMkDays As String = "Days"
Public Const strBkMkDayNames As String = "DayNames"
Public Const strBkMkYear As String = "Year"
' Calendar Style Names and Constants
Public Const wzBOXES As Integer = 0
Public Const wzBANNER As Integer = 1
Public Const wzJAZZY As Integer = 2
' Form Control
Public Const wzPAGE_START As Integer = 0
Public Const wzPAGE_STYLE As Integer = 1
Public Const wzPAGE_DIRECTION As Integer = 2
Public Const wzPAGE_MONTHS As Integer = 3
Public Const wzPAGE_FINISH As Integer = 4
'orientation
Public Const iORTN_PORTRAIT As Integer = 0
Public Const iORTN_LANDSCAPE As Integer = 1
' Assistant
Public Const iMAX_PANEL As Integer = 4 ' Number of last panel in MultiPage (First=0)
Public Const iCALL_BACK_COUNT As Integer = 3 ' Number of items in CallBackBalloon (First=1)
'postwizard balloon document variable
Public Const strPOST_WIZ_BLN As String = "Calendar post wizard balloon"
' VARIABLE DECLARATIONS
' General
Public rgstrMonthName(11) As String
Public rgstrDayName(6) As String
Public rgiDaysInMonth(11) As String
Public fDateError As Boolean
Public fCheckValidity As Boolean 'if set then the dates are checked for validity
'variables used in doc. creation
Public str1_TO_28 As String
Public rgsDaysHeight(2, 1, 1) As Single
Public rgsMonthNamesHeight(2, 1, 1) As Single
Public rgstrDaysStyle(2) As String
Public rgstrMonthNamesStyle(2) As String
Public strSTY_BANNER_HDG3 As String
' Assistant
Public rgstrAssistantMsg(iMAX_PANEL + 1) As String
Public rgstrCallBackMsg(iCALL_BACK_COUNT) As String
Public rgstrCallBackTip(iCALL_BACK_COUNT) As String
' Page 1
Public iCalendarStyle As Integer
Public iSavedStyle As Integer
' Page 2
' Page 3
' Page 4
Public Sub InitWizardName(fDummy As Boolean)
strWizName = "Calendar Wizard"
strWizLongName = strWizName
strWizShortName = "Calendar"
End Sub
Public Sub InitWizardStrings(fDummy As Boolean)
Dim i As Integer
On Error GoTo FatalError
'=============================== LOCALIZATION BLOCK ===============================
' Note: this list is indexed 0 - iMAX_PANEL
rgstrAssistantMsg(0) = "The Calendar Wizard helps you create a monthly calendar that you can customize with pictures and events. If you want to track and be reminded of events, you should probably use Microsoft Outlook, Microsoft Schedule+, or Microsoft Exchange."
rgstrAssistantMsg(1) = "Select the look you want for your calendar. The Jazzy style uses the Algerian font. If it is not installed on your system, copy alger.ttf from the Valupack folder on the Microsoft Office CD to your hard drive."
rgstrAssistantMsg(2) = "If you leave room for a picture, Word will insert a placeholder picture that you can replace with any picture you want."
rgstrAssistantMsg(3) = "Your calendar can start on any month, and you can make your calendar shorter than or longer than 12 months. Each month will appear on a different page."
rgstrAssistantMsg(4) = "To change any settings, click Back."
' Note: change constant iCALL_BACK_COUNT if number of items in list changes
rgstrCallBackMsg(0) = "Add, remove, or replace a picture"
rgstrCallBackMsg(1) = "Enter information into the calendar"
rgstrCallBackMsg(2) = "Get Help on Something Else..."
rgstrCallBackTip(0) = "To remove a picture, click on it and then press Delete. To add a picture, click where you want to insert the picture, point to Picture on the Insert menu, and then click From File."
rgstrCallBackTip(1) = "To enter information, click where you want to insert the text and start typing. To move between different dates in the calendar, press Tab to move forward or press Shift+Tab to move to the previous date."
'Load Month Name array
rgstrMonthName(0) = "January"
rgstrMonthName(1) = "February"
rgstrMonthName(2) = "March"
rgstrMonthName(3) = "April"
rgstrMonthName(4) = "May"
rgstrMonthName(5) = "June"
rgstrMonthName(6) = "July"
rgstrMonthName(7) = "August"
rgstrMonthName(8) = "September"
rgstrMonthName(9) = "October"
rgstrMonthName(10) = "November"
rgstrMonthName(11) = "December"
'Load Day Name array LOCALIZATION NOTE: DO NOT CHANGE THE ORDER IN WHICH THESE APPEAR!
' TO CHANGE THE WEEK START DAY, CHANGE THE CONSTANT iWeekStartDay
rgstrDayName(0) = "Sun"
rgstrDayName(1) = "Mon"
rgstrDayName(2) = "Tue"
rgstrDayName(3) = "Wed"
rgstrDayName(4) = "Thu"
rgstrDayName(5) = "Fri"
rgstrDayName(6) = "Sat"
'Load Days In Month array
rgiDaysInMonth(0) = 31
rgiDaysInMonth(1) = 28 'Will not be used - must be calculated for leap year accuracy
rgiDaysInMonth(2) = 31
rgiDaysInMonth(3) = 30
rgiDaysInMonth(4) = 31
rgiDaysInMonth(5) = 30
rgiDaysInMonth(6) = 31
rgiDaysInMonth(7) = 31
rgiDaysInMonth(8) = 30
rgiDaysInMonth(9) = 31
rgiDaysInMonth(10) = 30
rgiDaysInMonth(11) = 31
rgstrDaysStyle(wzBOXES) = "Boxes"
rgstrDaysStyle(wzBANNER) = "Banner"
rgstrDaysStyle(wzJAZZY) = "Jazzy"
rgstrMonthNamesStyle(wzBOXES) = "Boxes Heading2"
rgstrMonthNamesStyle(wzBANNER) = "Banner Heading2"
'we dont set the style for month names in Jazzy style
'the Banner style landscape calendar with picture uses Banner Heading3 style for month names
strSTY_BANNER_HDG3 = "Banner Heading3"
rgsMonthNamesHeight(wzBOXES, iORTN_PORTRAIT, 0) = 55
rgsMonthNamesHeight(wzBOXES, iORTN_PORTRAIT, 1) = 55
rgsMonthNamesHeight(wzBOXES, iORTN_LANDSCAPE, 0) = 36
rgsMonthNamesHeight(wzBOXES, iORTN_LANDSCAPE, 1) = 36
rgsDaysHeight(wzBOXES, iORTN_PORTRAIT, 0) = 56
rgsDaysHeight(wzBOXES, iORTN_PORTRAIT, 1) = 102
rgsDaysHeight(wzBOXES, iORTN_LANDSCAPE, 0) = 72
rgsDaysHeight(wzBOXES, iORTN_LANDSCAPE, 1) = 71
rgsMonthNamesHeight(wzBANNER, iORTN_PORTRAIT, 0) = 60
rgsMonthNamesHeight(wzBANNER, iORTN_PORTRAIT, 1) = 60
rgsMonthNamesHeight(wzBANNER, iORTN_LANDSCAPE, 0) = 55
rgsMonthNamesHeight(wzBANNER, iORTN_LANDSCAPE, 1) = 51
rgsDaysHeight(wzBANNER, iORTN_PORTRAIT, 0) = 64
rgsDaysHeight(wzBANNER, iORTN_PORTRAIT, 1) = 110
rgsDaysHeight(wzBANNER, iORTN_LANDSCAPE, 0) = 81
rgsDaysHeight(wzBANNER, iORTN_LANDSCAPE, 1) = 81
rgsMonthNamesHeight(wzJAZZY, iORTN_PORTRAIT, 0) = 73
rgsMonthNamesHeight(wzJAZZY, iORTN_PORTRAIT, 1) = 73
rgsMonthNamesHeight(wzJAZZY, iORTN_LANDSCAPE, 0) = 62
rgsMonthNamesHeight(wzJAZZY, iORTN_LANDSCAPE, 1) = 59
rgsDaysHeight(wzJAZZY, iORTN_PORTRAIT, 0) = 40.5
rgsDaysHeight(wzJAZZY, iORTN_PORTRAIT, 1) = 81.8
rgsDaysHeight(wzJAZZY, iORTN_LANDSCAPE, 0) = 58.2
rgsDaysHeight(wzJAZZY, iORTN_LANDSCAPE, 1) = 57.5
str1_TO_28 = ""
For i = 1 To 28
str1_TO_28 = str1_TO_28 & CStr(i) & vbTab
Next i
'strip off last tab
str1_TO_28 = Left$(str1_TO_28, Len(str1_TO_28) - 1)
' Location in registry DO NOT LOCALIZE
strRegSettingsKey = strREG_SETTINGS_BASE_KEY & "Calendar Wizard"
Exit Sub
FatalError:
ReportError Err
End Sub ' InitWizardStrings
Public Sub InitWizard(fDummy As Boolean)
' Global Vars
fWizardCallBack = False
fDateError = False
iCurrentPanel = 0
' Initialize strings
InitWizardStrings (True)
' Create a new instance of the form
Set formWizard = New formWizDlg
If formWizard Is Nothing Then GoTo FatalError
formWizard.lblWizName1.Caption = " " & strWizLongName & " "
Exit Sub
FatalError:
DisplayErrorMsg strERR_INIT_FORM
ReportError Err
End Sub
' fDummy prevents sub from appearing in Word Tools/Macro list
Public Sub SaveDialogValues(fDummy As Boolean)
On Error GoTo FatalError
' Display status
Application.ScreenUpdating = False
System.Cursor = wdCursorWait
StatusBar = strSAVE_SETTINGS
' Assistant
System.PrivateProfileString("", strREG_SETTINGS_BASE_KEY, strREG_ASSISTANT_TIME_STAMP) = Format$(Now, "General Date")
StoreValPref strREG_ASSISTANT_HELP, iLocalState
' Page 1
StoreValPref "iCalendarStyle", iCalendarStyle
' Page 2
StoreValPref "optPortrait", formWizard.optPortrait.Value
StoreValPref "optPictureYes", formWizard.optPictureYes.Value
' Page 3
StatusBar = ""
System.Cursor = wdCursorNormal
fSettingsSaved = True
Application.ScreenUpdating = True
Exit Sub
FatalError:
ReportError Err
End Sub
Public Sub RestoreDialogValues(fDummy As Boolean)
Dim i As Integer
On Error GoTo FatalError
' Display status
Application.ScreenUpdating = False
StatusBar = strRST_SETTINGS
System.Cursor = wdCursorWait
' Page 1
iCalendarStyle = IRestorePref("iCalendarStyle", 0)
Select Case iCalendarStyle
Case wzBOXES
formWizard.optBoxes.Value = True
formWizard.shpShadowBoxes.Visible = True
Case wzBANNER
formWizard.optBanner.Value = True
formWizard.shpShadowBanner.Visible = True
Case wzJAZZY
formWizard.optJazzy.Value = True
formWizard.shpShadowJazzy.Visible = True
Case Else
iCalendarStyle = wzBOXES
formWizard.optBoxes.Value = True
formWizard.shpShadowBoxes.Visible = True
End Select
' Page 2
If FRestorePref("optPortrait", False) Then
formWizard.optPortrait.Value = True
formWizard.shpPortraitShadow.Visible = True
formWizard.shpLandscapeShadow.Visible = False
Else
formWizard.optLandscape.Value = True
formWizard.shpPortraitShadow.Visible = False
formWizard.shpLandscapeShadow.Visible = True
End If
formWizard.optPictureYes.Value = FRestorePref("optPictureYes", False)
' Page 3
formWizard.cboMonthStart.ListIndex = Month(Date) - 1
formWizard.cboMonthEnd.ListIndex = Month(Date) - 1
formWizard.txtYearStart = Year(Date)
formWizard.txtYearEnd = Year(Date)
fCheckValidity = False
StatusBar = ""
System.Cursor = wdCursorNormal
fSettingsRestored = True
Application.ScreenUpdating = True
Exit Sub
FatalError:
ReportError Err
Exit Sub
End Sub ' RestoreDialogValues
' fDummy prevents sub from appearing in Word Tools/Macro list
Public Sub CreateNewDoc(fDummy As Boolean)
Dim iMonthCurr As Integer
Dim iYearCurr As Integer
Dim lYearMonthCurr As Long
Dim lYearMonthEnd As Long
Dim iDaysCnt As Integer
Dim iDaysInMonth As Integer
Dim iCnt As Integer
Dim strAutoTextName As String
Dim objTableDays As Table
Dim iRow As Integer
Dim iCol As Integer
Dim ocboMonthStart As ComboBox
Dim ocboMonthEnd As ComboBox
Dim otxtYearStart As TextBox
Dim otxtYearEnd As TextBox
Dim strJazzyDayNames As String
Dim objFps As PageSetup
Dim objRng As Range
Dim sShortMargin As Single
Dim sLongMargin As Single
Dim strCaptionTxt As String
Dim iOrientation As Integer
Dim iNoPicture As Integer
Dim i As Integer
Dim strDays As String
On Error GoTo CreateNewDoc_Error
System.Cursor = wdCursorWait
Set ocboMonthStart = formWizard.cboMonthStart
Set ocboMonthEnd = formWizard.cboMonthEnd
Set otxtYearStart = formWizard.txtYearStart
Set otxtYearEnd = formWizard.txtYearEnd
With Application
.ScreenUpdating = False
.StatusBar = strStatusIntro
End With
Set objActiveRange = ActiveDocument.Content
objActiveRange.Collapse wdCollapseEnd
If (formWizard.optPortrait) Then
iOrientation = iORTN_PORTRAIT
Else
iOrientation = iORTN_LANDSCAPE
End If
iNoPicture = Abs(formWizard.optPictureNo.Value)
'the margins have to be changed if papersize was changed in Common
If (fChangeToA4 Or fChangeToLetter) Then
Set objFps = ActiveDocument.PageSetup
If iOrientation = iORTN_LANDSCAPE Then
objFps.Orientation = wdOrientLandscape 'setting paper size in common
'resets orientation to Portrait
If fChangeToA4 Then
sShortMargin = sA4_SHORT_MARGIN
sLongMargin = sA4_LONG_MARGIN
Else
sShortMargin = sLETTER_SHORT_MARGIN
sLongMargin = sLETTER_LONG_MARGIN
End If
Else
If fChangeToA4 Then
sShortMargin = sA4_LONG_MARGIN
sLongMargin = sA4_SHORT_MARGIN
Else
sShortMargin = sLETTER_LONG_MARGIN
sLongMargin = sLETTER_SHORT_MARGIN
End If
End If
With objFps
.TopMargin = sShortMargin
.BottomMargin = sShortMargin
.LeftMargin = sLongMargin
.RightMargin = sLongMargin
End With
End If
strAutoTextName = StrBuildAutoTextName(True)
objWizTemplate.AutoTextEntries(strAutoTextName).Insert objActiveRange, True
If iCalendarStyle <> wzJAZZY Then
Set objActiveRange = ActiveDocument.Bookmarks(strBkMkDays).Range
Else
Set objActiveRange = ActiveDocument.Bookmarks(strBkMkDayNames).Range
End If
strJazzyDayNames = ""
For iCnt = iWeekStartDay To 6
strJazzyDayNames = strJazzyDayNames & rgstrDayName(iCnt) & vbTab
Next
For iCnt = 0 To (iWeekStartDay - 1)
strJazzyDayNames = strJazzyDayNames & rgstrDayName(iCnt) & vbTab
Next
'Strip trailing Tab
strJazzyDayNames = Left$(strJazzyDayNames, Len(strJazzyDayNames) - 1)
objActiveRange.Text = strJazzyDayNames
If iCalendarStyle <> wzJAZZY Then
If (iCalendarStyle = wzBANNER) And (iOrientation = iORTN_LANDSCAPE) And (iNoPicture = 0) Then
objActiveRange.Style = strSTY_BANNER_HDG3
Else
objActiveRange.Style = rgstrMonthNamesStyle(iCalendarStyle)
End If
objActiveRange.Select
Selection.ConvertToTable wdSeparateByTabs, 1, 7
End If
Set objActiveRange = ActiveDocument.Content
objActiveRange.Copy
iMonthCurr = CInt(ocboMonthStart.ListIndex) + 1
iYearCurr = CInt(otxtYearStart.Text)
lYearMonthCurr = (CLng(iYearCurr) * 100) + CLng(iMonthCurr)
lYearMonthEnd = (CLng(otxtYearEnd.Text) * 100) + (CLng(ocboMonthEnd.ListIndex) + 1)
'Create each month of the calendar
Do Until lYearMonthCurr > lYearMonthEnd
Application.StatusBar = strStatusPart1 & rgstrMonthName(iMonthCurr - 1) & strStatusPart2 & CStr(iYearCurr) & strStatusPart3
'Set month
If iCalendarStyle = wzJAZZY Then
ActiveDocument.Bookmarks(strBkMkMonth).Range.Text = CStr(iMonthCurr)
Else
ActiveDocument.Bookmarks(strBkMkMonth).Range.Text = rgstrMonthName(iMonthCurr - 1)
End If
'Set year
ActiveDocument.Bookmarks(strBkMkYear).Range.Text = CStr(iYearCurr)
'Determine number of days in month
If iMonthCurr = 2 Then
iDaysInMonth = DateSerial(iYearCurr, 3, 1) - DateSerial(iYearCurr, 2, 1)
Else
iDaysInMonth = rgiDaysInMonth(iMonthCurr - 1)
End If
'Set Column of First Day Of Month by using Weekday function. The 8th
'is used (to start with) instead of the 1st to allow for offsetting (via
'iWeekStartDay) for localization since the 8th will always fall on the
'same day (of the week) as the 1st.
iCol = WeekDay(DateSerial(iYearCurr, iMonthCurr, 8 - iWeekStartDay))
ActiveDocument.Bookmarks(strBkMkDays).Select
If iCalendarStyle <> wzJAZZY Then _
Selection.MoveDown wdLine 'the bookmark is now in the first cell of the table
strDays = ""
For i = 1 To iCol - 1
strDays = strDays & vbTab
Next i
strDays = strDays & str1_TO_28
For i = 29 To iDaysInMonth
strDays = strDays & vbTab & CStr(i)
Next i
'to get a 6 * 7 table always
For i = iDaysInMonth + iCol - 1 To 41
strDays = strDays & vbTab
Next i
Set objActiveRange = Selection.Range
objActiveRange.Text = strDays
objActiveRange.Style = rgstrDaysStyle(iCalendarStyle) & iOrientation & iNoPicture
objActiveRange.Select
Selection.ConvertToTable wdSeparateByTabs, 6, 7
Selection.Cells.Height = rgsDaysHeight(iCalendarStyle, iOrientation, iNoPicture)
Selection.Tables(1).Rows(1).Height = rgsMonthNamesHeight(iCalendarStyle, iOrientation, iNoPicture)
'========================================================
' Mn.Sept.01.2014; 08h21
' TABLE GRIDLINES CODE: Automatically creates printable gridlines in the table.
With Selection.Tables(1).Borders
.InsideLineStyle = wdLineStyleSingle
.InsideLineWidth = wdLineWidth100pt
.InsideColorIndex = wdAuto
.OutsideLineStyle = wdLineStyleSingle
.OutsideLineWidth = wdLineWidth100pt
End With
'========================================================
ActiveDocument.Bookmarks(strBkMkDays).Delete
'Advance the current month
If iMonthCurr = 12 Then
iMonthCurr = 1
iYearCurr = iYearCurr + 1
Else
iMonthCurr = iMonthCurr + 1
End If
lYearMonthCurr = (CLng(iYearCurr) * 100) + CLng(iMonthCurr)
If lYearMonthCurr <= lYearMonthEnd Then
Set objActiveRange = ActiveDocument.Content
objActiveRange.Collapse wdCollapseEnd
'Insert Page Break
objActiveRange.InsertBreak wdPageBreak
Set objActiveRange = ActiveDocument.Content
objActiveRange.Collapse wdCollapseEnd
objActiveRange.Paste
End If
Loop
Application.StatusBar = ""
strCaptionTxt = ""
'Set Application caption
strCaptionTxt = " - " & strAppCaptionPart1 & strAppCaptionPart1b & ocboMonthStart.Text & strAppCaptionPart2 & otxtYearStart.Text & strAppCaptionPart3 & ocboMonthEnd.Text & strAppCaptionPart4 & otxtYearEnd.Text
ActiveDocument.UndoClear
With ActiveWindow
.Caption = .Caption & strCaptionTxt
With .View
.TableGridlines = False
.ShowDrawings = True
End With
End With
'Position cursor at the top
Selection.HomeKey wdStory
CreateNewDoc_Exit:
Exit Sub
CreateNewDoc_Error:
ReportError Err
GoTo CreateNewDoc_Exit
End Sub ' CreateNewDoc
Public Sub InitCallBack(fDummy As Boolean)
Dim i As Integer
Dim objCallBackLabels As BalloonLabels
On Error GoTo ErrorCallBack
If Not (fBlnInitialized) Then
Set objPostWizBln = Assistant.NewBalloon
fBlnInitialized = True
With objPostWizBln
.Heading = strCallBackHeading
.Mode = msoModeModeless
.Button = msoButtonSetCancel
.BalloonType = msoBalloonTypeButtons
.Callback = "Calendar.fnCallBack"
End With
Set objCallBackLabels = objPostWizBln.Labels
objCallBackLabels.Count = iCALL_BACK_COUNT
For i = 1 To iCALL_BACK_COUNT
objCallBackLabels.Item(i).Text = rgstrCallBackMsg(i - 1)
Next i
End If
objPostWizBln.Show
If (Assistant.BalloonError) Then GoTo ErrorCallBack
fPostWizBlnOpen = True
Set objDocBln = ActiveDocument
Set clsBln.app = Application
ActiveDocument.Variables.Add strPOST_WIZ_BLN, "1"
Exit Sub
ErrorCallBack:
DisplayErrorMsg strERR_INIT_CALL_BACK
fPostWizBlnOpen = False
Set objDocBln = ActiveDocument
Set clsBln.app = Application
ActiveDocument.Variables.Add strPOST_WIZ_BLN, "0"
End Sub
Public Function fnCallBack(objBln As Balloon, iBtn As Integer, lPrivate As Long)
On Error GoTo ErrorCallBack
Select Case iBtn
Case Is < 1 'Exit
objBln.Close
fPostWizBlnOpen = False
ActiveDocument.Variables(strPOST_WIZ_BLN).Value = "0"
RestoreAssistant (True)
Case 1 'Remove existing picture
DisplayTip rgstrCallBackTip(0)
Case 2 'Enter information into calendar
DisplayTip rgstrCallBackTip(1)
Case 3 ' Get help
Assistant.Help
End Select
Exit Function
ErrorCallBack:
DisplayErrorMsg Err.Description
End Function
Private Function StrBuildAutoTextName(fDummy As Boolean) As String
Dim strATName As String
On Error GoTo BuildAutoTextName_Error
'Select base AutoText Name NOTE: DO NOT LOCALIZE
Select Case iCalendarStyle
Case wzBOXES
strATName = "Boxes"
Case wzBANNER
strATName = "Banner"
Case wzJAZZY
strATName = "Jazzy"
End Select
strATName = strATName & CStr(Abs(formWizard.optLandscape.Value))
strATName = strATName & CStr(Abs(formWizard.optPictureNo.Value))
StrBuildAutoTextName = strATName
BuildAutoTextName_Exit:
Exit Function
BuildAutoTextName_Error:
StrBuildAutoTextName = ""
Resume BuildAutoTextName_Exit
End Function
'displays a tip during post-wizard options
'assumes that Assistant is present since it is called from post-wizard balloon
Private Sub DisplayTip(strTip As String)
Dim objBlnTip As Balloon
On Error GoTo FatalError
Set objBlnTip = Assistant.NewBalloon
With objBlnTip
.Mode = msoModeModal
.Heading = strWizName
.Text = strTip
.Button = msoButtonSetOK
End With
objBlnTip.Show
If Assistant.BalloonError <> msoBalloonErrorNone Then GoTo FatalError
Exit Sub
FatalError:
Err.Clear
End Sub
The above is from the module labelled "Calendar". I don't believe anything was altered in the module labelled "Common", but please let me know that I should post it.
To recap, in this wizard file, the first day of the week is set for Monday. So the Saturday and Sunday columns always fall as the last 2 columns in the calendar table (Sunday as first day has the 1st and last column as the ones that would need shading).
How can that syntax be added to shade the last 2 columns in the Monday calendar wizard, and the 1st and last column for the Sunday calendar wizard and hopefully shading just those particular cells in either with numbers in them?
Thank you! Very much appreciated.Thanks, Doug! Works beautifully. I tried them again this morning, really incredible!
I'm going to keep the Monday and Sunday wizard files as separate files because I realized that I don't have the skills (or the time) to try to figure out how to modify it so the user is requested the starting day. It'll be beyond my meager skills,
I'm sure, especially since there are all those dialogue boxes to contend with at the wizard's start. I was forgetting about those. So leaving these as 2 separate files where one chooses the starting day as per the title, the Monday one for Monday
and the other, the Sunday one, for a Sunday start day.
However, the only difference between them at this point is that one has a "0" for Sunday and the other a "1" for Monday, at the appropriate spots in the code. being the starting week day and the other a "1" for Monday.
That's it. They're beautifully the same in the rest of the code. And a further benefit is that only one module was touched at all for all of this, the Calendar module (leaving the one labelled "Common" untouched.
So anyone with a calendar wizard file can just change the piece of code below (begging the group's indulgence, if I may, in posting the modified code (??):
' WORD 97 WIZARD
' Calendar Wizard Specific Code
Option Explicit
' CONSTANT DECLARATIONS
'=============================== LOCALIZATION BLOCK ===============================
' Localization Note: iWeekStartDay is the starting day of the week (Sun = 0, Mon = 1, ...Sat = 6)
Public Const iWeekStartDay As Integer = 1
' Banter strings
Public Const strWarnYearReq As String = "Both starting and ending years are required."
Public Const strWarnMinExceeded As String = "The year can not be before 1900."
Public Const strWarnMaxExceeded As String = "The year can not be after 4095."
Public Const strWarnRangeExceeded As String = "The calendar is limited to 120 months (10 years)."
Public Const strAppCaptionPart1 As String = "Calendar: "
Public Const strAppCaptionPart1b As String = ""
Public Const strAppCaptionPart2 As String = ", "
Public Const strAppCaptionPart3 As String = " to "
Public Const strAppCaptionPart4 As String = ", "
' Status messages
Public Const strStatusIntro As String = "Creating Calendar..."
Public Const strStatusPart1 As String = "Creating "
Public Const strStatusPart2 As String = ", "
Public Const strStatusPart3 As String = "..."
' Assistant
Public Const strCallBackHeading As String = "Do more with the calendar?"
'Margins for A4 size (if wizard changes pagesize to A4)
Public Const sA4_SHORT_MARGIN As Single = 28.8
Public Const sA4_LONG_MARGIN As Single = 57.6
'Margins for Letter size (if wizard changes pagesize to Letter) in pts
Public Const sLETTER_SHORT_MARGIN As Single = 36
Public Const sLETTER_LONG_MARGIN As Single = 36
'========== END LOCALIZATION BLOCK - DO NOT MAKE CHANGES BELOW THIS LINE ==========
Public Const iYearMin As Integer = 1900
Public Const iYearMax As Integer = 4095
' Bookmark Names - DO NOT LOCALIZE
' Note: No spaces allowed in bookmark names
Public Const strBkMkMonth As String = "Month"
Public Const strBkMkDays As String = "Days"
Public Const strBkMkDayNames As String = "DayNames"
Public Const strBkMkYear As String = "Year"
' Calendar Style Names and Constants
Public Const wzBOXES As Integer = 0
Public Const wzBANNER As Integer = 1
Public Const wzJAZZY As Integer = 2
' Form Control
Public Const wzPAGE_START As Integer = 0
Public Const wzPAGE_STYLE As Integer = 1
Public Const wzPAGE_DIRECTION As Integer = 2
Public Const wzPAGE_MONTHS As Integer = 3
Public Const wzPAGE_FINISH As Integer = 4
'orientation
Public Const iORTN_PORTRAIT As Integer = 0
Public Const iORTN_LANDSCAPE As Integer = 1
' Assistant
Public Const iMAX_PANEL As Integer = 4 ' Number of last panel in MultiPage (First=0)
Public Const iCALL_BACK_COUNT As Integer = 3 ' Number of items in CallBackBalloon (First=1)
'postwizard balloon document variable
Public Const strPOST_WIZ_BLN As String = "Calendar post wizard balloon"
' VARIABLE DECLARATIONS
' General
Public rgstrMonthName(11) As String
Public rgstrDayName(6) As String
Public rgiDaysInMonth(11) As String
Public fDateError As Boolean
Public fCheckValidity As Boolean 'if set then the dates are checked for validity
'variables used in doc. creation
Public str1_TO_28 As String
Public rgsDaysHeight(2, 1, 1) As Single
Public rgsMonthNamesHeight(2, 1, 1) As Single
Public rgstrDaysStyle(2) As String
Public rgstrMonthNamesStyle(2) As String
Public strSTY_BANNER_HDG3 As String
' Assistant
Public rgstrAssistantMsg(iMAX_PANEL + 1) As String
Public rgstrCallBackMsg(iCALL_BACK_COUNT) As String
Public rgstrCallBackTip(iCALL_BACK_COUNT) As String
' Page 1
Public iCalendarStyle As Integer
Public iSavedStyle As Integer
' Page 2
' Page 3
' Page 4
Public Sub InitWizardName(fDummy As Boolean)
strWizName = "Calendar Wizard"
strWizLongName = strWizName
strWizShortName = "Calendar"
End Sub
Public Sub InitWizardStrings(fDummy As Boolean)
Dim i As Integer
On Error GoTo FatalError
'=============================== LOCALIZATION BLOCK ===============================
' Note: this list is indexed 0 - iMAX_PANEL
rgstrAssistantMsg(0) = "The Calendar Wizard helps you create a monthly calendar that you can customize with pictures and events. If you want to track and be reminded of events, you should probably use Microsoft Outlook, Microsoft Schedule+, or Microsoft Exchange."
rgstrAssistantMsg(1) = "Select the look you want for your calendar. The Jazzy style uses the Algerian font. If it is not installed on your system, copy alger.ttf from the Valupack folder on the Microsoft Office CD to your hard drive."
rgstrAssistantMsg(2) = "If you leave room for a picture, Word will insert a placeholder picture that you can replace with any picture you want."
rgstrAssistantMsg(3) = "Your calendar can start on any month, and you can make your calendar shorter than or longer than 12 months. Each month will appear on a different page."
rgstrAssistantMsg(4) = "To change any settings, click Back."
' Note: change constant iCALL_BACK_COUNT if number of items in list changes
rgstrCallBackMsg(0) = "Add, remove, or replace a picture"
rgstrCallBackMsg(1) = "Enter information into the calendar"
rgstrCallBackMsg(2) = "Get Help on Something Else..."
rgstrCallBackTip(0) = "To remove a picture, click on it and then press Delete. To add a picture, click where you want to insert the picture, point to Picture on the Insert menu, and then click From File."
rgstrCallBackTip(1) = "To enter information, click where you want to insert the text and start typing. To move between different dates in the calendar, press Tab to move forward or press Shift+Tab to move to the previous date."
'Load Month Name array
rgstrMonthName(0) = "January"
rgstrMonthName(1) = "February"
rgstrMonthName(2) = "March"
rgstrMonthName(3) = "April"
rgstrMonthName(4) = "May"
rgstrMonthName(5) = "June"
rgstrMonthName(6) = "July"
rgstrMonthName(7) = "August"
rgstrMonthName(8) = "September"
rgstrMonthName(9) = "October"
rgstrMonthName(10) = "November"
rgstrMonthName(11) = "December"
'Load Day Name array LOCALIZATION NOTE: DO NOT CHANGE THE ORDER IN WHICH THESE APPEAR!
' TO CHANGE THE WEEK START DAY, CHANGE THE CONSTANT iWeekStartDay
rgstrDayName(0) = "Sun"
rgstrDayName(1) = "Mon"
rgstrDayName(2) = "Tue"
rgstrDayName(3) = "Wed"
rgstrDayName(4) = "Thu"
rgstrDayName(5) = "Fri"
rgstrDayName(6) = "Sat"
'Load Days In Month array
rgiDaysInMonth(0) = 31
rgiDaysInMonth(1) = 28 'Will not be used - must be calculated for leap year accuracy
rgiDaysInMonth(2) = 31
rgiDaysInMonth(3) = 30
rgiDaysInMonth(4) = 31
rgiDaysInMonth(5) = 30
rgiDaysInMonth(6) = 31
rgiDaysInMonth(7) = 31
rgiDaysInMonth(8) = 30
rgiDaysInMonth(9) = 31
rgiDaysInMonth(10) = 30
rgiDaysInMonth(11) = 31
rgstrDaysStyle(wzBOXES) = "Boxes"
rgstrDaysStyle(wzBANNER) = "Banner"
rgstrDaysStyle(wzJAZZY) = "Jazzy"
rgstrMonthNamesStyle(wzBOXES) = "Boxes Heading2"
rgstrMonthNamesStyle(wzBANNER) = "Banner Heading2"
'we dont set the style for month names in Jazzy style
'the Banner style landscape calendar with picture uses Banner Heading3 style for month names
strSTY_BANNER_HDG3 = "Banner Heading3"
rgsMonthNamesHeight(wzBOXES, iORTN_PORTRAIT, 0) = 55
rgsMonthNamesHeight(wzBOXES, iORTN_PORTRAIT, 1) = 55
rgsMonthNamesHeight(wzBOXES, iORTN_LANDSCAPE, 0) = 36
rgsMonthNamesHeight(wzBOXES, iORTN_LANDSCAPE, 1) = 36
rgsDaysHeight(wzBOXES, iORTN_PORTRAIT, 0) = 56
rgsDaysHeight(wzBOXES, iORTN_PORTRAIT, 1) = 102
rgsDaysHeight(wzBOXES, iORTN_LANDSCAPE, 0) = 72
rgsDaysHeight(wzBOXES, iORTN_LANDSCAPE, 1) = 71
rgsMonthNamesHeight(wzBANNER, iORTN_PORTRAIT, 0) = 60
rgsMonthNamesHeight(wzBANNER, iORTN_PORTRAIT, 1) = 60
rgsMonthNamesHeight(wzBANNER, iORTN_LANDSCAPE, 0) = 55
rgsMonthNamesHeight(wzBANNER, iORTN_LANDSCAPE, 1) = 51
rgsDaysHeight(wzBANNER, iORTN_PORTRAIT, 0) = 64
rgsDaysHeight(wzBANNER, iORTN_PORTRAIT, 1) = 110
rgsDaysHeight(wzBANNER, iORTN_LANDSCAPE, 0) = 81
rgsDaysHeight(wzBANNER, iORTN_LANDSCAPE, 1) = 81
rgsMonthNamesHeight(wzJAZZY, iORTN_PORTRAIT, 0) = 73
rgsMonthNamesHeight(wzJAZZY, iORTN_PORTRAIT, 1) = 73
rgsMonthNamesHeight(wzJAZZY, iORTN_LANDSCAPE, 0) = 62
rgsMonthNamesHeight(wzJAZZY, iORTN_LANDSCAPE, 1) = 59
rgsDaysHeight(wzJAZZY, iORTN_PORTRAIT, 0) = 40.5
rgsDaysHeight(wzJAZZY, iORTN_PORTRAIT, 1) = 81.8
rgsDaysHeight(wzJAZZY, iORTN_LANDSCAPE, 0) = 58.2
rgsDaysHeight(wzJAZZY, iORTN_LANDSCAPE, 1) = 57.5
str1_TO_28 = ""
For i = 1 To 28
str1_TO_28 = str1_TO_28 & CStr(i) & vbTab
Next i
'strip off last tab
str1_TO_28 = Left$(str1_TO_28, Len(str1_TO_28) - 1)
' Location in registry DO NOT LOCALIZE
strRegSettingsKey = strREG_SETTINGS_BASE_KEY & "Calendar Wizard"
Exit Sub
FatalError:
ReportError Err
End Sub ' InitWizardStrings
Public Sub InitWizard(fDummy As Boolean)
' Global Vars
fWizardCallBack = False
fDateError = False
iCurrentPanel = 0
' Initialize strings
InitWizardStrings (True)
' Create a new instance of the form
Set formWizard = New formWizDlg
If formWizard Is Nothing Then GoTo FatalError
formWizard.lblWizName1.Caption = " " & strWizLongName & " "
Exit Sub
FatalError:
DisplayErrorMsg strERR_INIT_FORM
ReportError Err
End Sub
' fDummy prevents sub from appearing in Word Tools/Macro list
Public Sub SaveDialogValues(fDummy As Boolean)
On Error GoTo FatalError
' Display status
Application.ScreenUpdating = False
System.Cursor = wdCursorWait
StatusBar = strSAVE_SETTINGS
' Assistant
System.PrivateProfileString("", strREG_SETTINGS_BASE_KEY, strREG_ASSISTANT_TIME_STAMP) = Format$(Now, "General Date")
StoreValPref strREG_ASSISTANT_HELP, iLocalState
' Page 1
StoreValPref "iCalendarStyle", iCalendarStyle
' Page 2
StoreValPref "optPortrait", formWizard.optPortrait.Value
StoreValPref "optPictureYes", formWizard.optPictureYes.Value
' Page 3
StatusBar = ""
System.Cursor = wdCursorNormal
fSettingsSaved = True
Application.ScreenUpdating = True
Exit Sub
FatalError:
ReportError Err
End Sub
Public Sub RestoreDialogValues(fDummy As Boolean)
Dim i As Integer
On Error GoTo FatalError
' Display status
Application.ScreenUpdating = False
StatusBar = strRST_SETTINGS
System.Cursor = wdCursorWait
' Page 1
iCalendarStyle = IRestorePref("iCalendarStyle", 0)
Select Case iCalendarStyle
Case wzBOXES
formWizard.optBoxes.Value = True
formWizard.shpShadowBoxes.Visible = True
Case wzBANNER
formWizard.optBanner.Value = True
formWizard.shpShadowBanner.Visible = True
Case wzJAZZY
formWizard.optJazzy.Value = True
formWizard.shpShadowJazzy.Visible = True
Case Else
iCalendarStyle = wzBOXES
formWizard.optBoxes.Value = True
formWizard.shpShadowBoxes.Visible = True
End Select
' Page 2
If FRestorePref("optPortrait", False) Then
formWizard.optPortrait.Value = True
formWizard.shpPortraitShadow.Visible = True
formWizard.shpLandscapeShadow.Visible = False
Else
formWizard.optLandscape.Value = True
formWizard.shpPortraitShadow.Visible = False
formWizard.shpLandscapeShadow.Visible = True
End If
formWizard.optPictureYes.Value = FRestorePref("optPictureYes", False)
' Page 3
formWizard.cboMonthStart.ListIndex = Month(Date) - 1
formWizard.cboMonthEnd.ListIndex = Month(Date) - 1
formWizard.txtYearStart = Year(Date)
formWizard.txtYearEnd = Year(Date)
fCheckValidity = False
StatusBar = ""
System.Cursor = wdCursorNormal
fSettingsRestored = True
Application.ScreenUpdating = True
Exit Sub
FatalError:
ReportError Err
Exit Sub
End Sub ' RestoreDialogValues
' fDummy prevents sub from appearing in Word Tools/Macro list
Public Sub CreateNewDoc(fDummy As Boolean)
Dim iMonthCurr As Integer
Dim iYearCurr As Integer
Dim lYearMonthCurr As Long
Dim lYearMonthEnd As Long
Dim iDaysCnt As Integer
Dim iDaysInMonth As Integer
Dim iCnt As Integer
Dim strAutoTextName As String
Dim objTableDays As Table
Dim iRow As Integer
Dim iCol As Integer
Dim ocboMonthStart As ComboBox
Dim ocboMonthEnd As ComboBox
Dim otxtYearStart As TextBox
Dim otxtYearEnd As TextBox
Dim strJazzyDayNames As String
Dim objFps As PageSetup
Dim objRng As Range
Dim sShortMargin As Single
Dim sLongMargin As Single
Dim strCaptionTxt As String
Dim iOrientation As Integer
Dim iNoPicture As Integer
Dim i As Integer
Dim strDays As String
On Error GoTo CreateNewDoc_Error
System.Cursor = wdCursorWait
Set ocboMonthStart = formWizard.cboMonthStart
Set ocboMonthEnd = formWizard.cboMonthEnd
Set otxtYearStart = formWizard.txtYearStart
Set otxtYearEnd = formWizard.txtYearEnd
With Application
.ScreenUpdating = False
.StatusBar = strStatusIntro
End With
Set objActiveRange = ActiveDocument.Content
objActiveRange.Collapse wdCollapseEnd
If (formWizard.optPortrait) Then
iOrientation = iORTN_PORTRAIT
Else
iOrientation = iORTN_LANDSCAPE
End If
iNoPicture = Abs(formWizard.optPictureNo.Value)
'the margins have to be changed if papersize was changed in Common
If (fChangeToA4 Or fChangeToLetter) Then
Set objFps = ActiveDocument.PageSetup
If iOrientation = iORTN_LANDSCAPE Then
objFps.Orientation = wdOrientLandscape 'setting paper size in common
'resets orientation to Portrait
If fChangeToA4 Then
sShortMargin = sA4_SHORT_MARGIN
sLongMargin = sA4_LONG_MARGIN
Else
sShortMargin = sLETTER_SHORT_MARGIN
sLongMargin = sLETTER_LONG_MARGIN
End If
Else
If fChangeToA4 Then
sShortMargin = sA4_LONG_MARGIN
sLongMargin = sA4_SHORT_MARGIN
Else
sShortMargin = sLETTER_LONG_MARGIN
sLongMargin = sLETTER_SHORT_MARGIN
End If
End If
With objFps
.TopMargin = sShortMargin
.BottomMargin = sShortMargin
.LeftMargin = sLongMargin
.RightMargin = sLongMargin
End With
End If
strAutoTextName = StrBuildAutoTextName(True)
objWizTemplate.AutoTextEntries(strAutoTextName).Insert objActiveRange, True
If iCalendarStyle <> wzJAZZY Then
Set objActiveRange = ActiveDocument.Bookmarks(strBkMkDays).Range
Else
Set objActiveRange = ActiveDocument.Bookmarks(strBkMkDayNames).Range
End If
strJazzyDayNames = ""
For iCnt = iWeekStartDay To 6
strJazzyDayNames = strJazzyDayNames & rgstrDayName(iCnt) & vbTab
Next
For iCnt = 0 To (iWeekStartDay - 1)
strJazzyDayNames = strJazzyDayNames & rgstrDayName(iCnt) & vbTab
Next
'Strip trailing Tab
strJazzyDayNames = Left$(strJazzyDayNames, Len(strJazzyDayNames) - 1)
objActiveRange.Text = strJazzyDayNames
If iCalendarStyle <> wzJAZZY Then
If (iCalendarStyle = wzBANNER) And (iOrientation = iORTN_LANDSCAPE) And (iNoPicture = 0) Then
objActiveRange.Style = strSTY_BANNER_HDG3
Else
objActiveRange.Style = rgstrMonthNamesStyle(iCalendarStyle)
End If
objActiveRange.Select
Selection.ConvertToTable wdSeparateByTabs, 1, 7
End If
Set objActiveRange = ActiveDocument.Content
objActiveRange.Copy
iMonthCurr = CInt(ocboMonthStart.ListIndex) + 1
iYearCurr = CInt(otxtYearStart.Text)
lYearMonthCurr = (CLng(iYearCurr) * 100) + CLng(iMonthCurr)
lYearMonthEnd = (CLng(otxtYearEnd.Text) * 100) + (CLng(ocboMonthEnd.ListIndex) + 1)
'Create each month of the calendar
Do Until lYearMonthCurr > lYearMonthEnd
Application.StatusBar = strStatusPart1 & rgstrMonthName(iMonthCurr - 1) & strStatusPart2 & CStr(iYearCurr) & strStatusPart3
'Set month
If iCalendarStyle = wzJAZZY Then
ActiveDocument.Bookmarks(strBkMkMonth).Range.Text = CStr(iMonthCurr)
Else
ActiveDocument.Bookmarks(strBkMkMonth).Range.Text = rgstrMonthName(iMonthCurr - 1)
End If
'Set year
ActiveDocument.Bookmarks(strBkMkYear).Range.Text = CStr(iYearCurr)
'Determine number of days in month
If iMonthCurr = 2 Then
iDaysInMonth = DateSerial(iYearCurr, 3, 1) - DateSerial(iYearCurr, 2, 1)
Else
iDaysInMonth = rgiDaysInMonth(iMonthCurr - 1)
End If
'Set Column of First Day Of Month by using Weekday function. The 8th
'is used (to start with) instead of the 1st to allow for offsetting (via
'iWeekStartDay) for localization since the 8th will always fall on the
'same day (of the week) as the 1st.
iCol = WeekDay(DateSerial(iYearCurr, iMonthCurr, 8 - iWeekStartDay))
ActiveDocument.Bookmarks(strBkMkDays).Select
If iCalendarStyle <> wzJAZZY Then _
Selection.MoveDown wdLine 'the bookmark is now in the first cell of the table
strDays = ""
For i = 1 To iCol - 1
strDays = strDays & vbTab
Next i
strDays = strDays & str1_TO_28
For i = 29 To iDaysInMonth
strDays = strDays & vbTab & CStr(i)
Next i
'to get a 6 * 7 table always
For i = iDaysInMonth + iCol - 1 To 41
strDays = strDays & vbTab
Next i
Set objActiveRange = Selection.Range
objActiveRange.Text = strDays
objActiveRange.Style = rgstrDaysStyle(iCalendarStyle) & iOrientation & iNoPicture
objActiveRange.Select
Selection.ConvertToTable wdSeparateByTabs, 6, 7
Selection.Cells.Height = rgsDaysHeight(iCalendarStyle, iOrientation, iNoPicture)
Selection.Tables(1).Rows(1).Height = rgsMonthNamesHeight(iCalendarStyle, iOrientation, iNoPicture)
'================================================================================================================================
' Tu.Mar.11.2015; 17h56 - MVPEdits/MyEdits
' SATURDAY and SUNDAY cells get shaded in the table (no matter where they fall).
' Doug Robbins - Word MVP; https://social.msdn.microsoft.com/Forums/office/en-US/6ab55be0-adc0-4e37-9565-8cdff089d20a/shading-certain-columns-depending-on-start-day-of-week?forum=worddev
Dim j As Long
With Selection.Tables(1)
If iWeekStartDay = 1 Then
For i = 6 To 7
With .Columns(i)
' For j = 1 To .Cells.Count ' 1 = Cells with SAT and SUN text are shaded
For j = 2 To .Cells.Count ' 2 = Cells with SAT and SUN text are _ NOT_ shaded
With .Cells(j).Range
If Len(.Text) > 2 Then
.Shading.BackgroundPatternColor = wdColorGray20 'wdColorGray_ _ _ (the number following gives the shade of gray, i.e., wdColorGray20 vs. wdColorGray50)
End If
End With
Next j
End With
Next i
Else
For i = 1 To 7 Step 6
With .Columns(i)
' For j = 1 To .Cells.Count ' 1 = Cells with SAT and SUN text are shaded
For j = 2 To .Cells.Count ' 2 = Cells with SAT and SUN text are _ NOT_ shaded
With .Cells(j).Range
If Len(.Text) > 2 Then
.Shading.BackgroundPatternColor = wdColorGray20 'wdColorGray_ _ _ (the number following gives the shade of gray, i.e., wdColorGray20 vs. wdColorGray50)
End If
End With
Next j
End With
Next i
End If
End With
'================================================================================================================================
'================================================================================================================================
' Mn.Sept.01.2014; 08h21 - MVPEdits/MyEdits
' TABLE GRIDLINES CODE: Automatically creates printable gridlines in the table.
With Selection.Tables(1).Borders
.InsideLineStyle = wdLineStyleSingle
.InsideLineWidth = wdLineWidth100pt
.InsideColorIndex = wdAuto
.OutsideLineStyle = wdLineStyleSingle
.OutsideLineWidth = wdLineWidth100pt
End With
'================================================================================================================================
ActiveDocument.Bookmarks(strBkMkDays).Delete
'Advance the current month
If iMonthCurr = 12 Then
iMonthCurr = 1
iYearCurr = iYearCurr + 1
Else
iMonthCurr = iMonthCurr + 1
End If
lYearMonthCurr = (CLng(iYearCurr) * 100) + CLng(iMonthCurr)
If lYearMonthCurr <= lYearMonthEnd Then
Set objActiveRange = ActiveDocument.Content
objActiveRange.Collapse wdCollapseEnd
'Insert Page Break
objActiveRange.InsertBreak wdPageBreak
Set objActiveRange = ActiveDocument.Content
objActiveRange.Collapse wdCollapseEnd
objActiveRange.Paste
End If
Loop
Application.StatusBar = ""
strCaptionTxt = ""
'Set Application caption
strCaptionTxt = " - " & strAppCaptionPart1 & strAppCaptionPart1b & ocboMonthStart.Text & strAppCaptionPart2 & otxtYearStart.Text & strAppCaptionPart3 & ocboMonthEnd.Text & strAppCaptionPart4 & otxtYearEnd.Text
ActiveDocument.UndoClear
With ActiveWindow
.Caption = .Caption & strCaptionTxt
With .View
.TableGridlines = False
.ShowDrawings = True
End With
End With
'Position cursor at the top
Selection.HomeKey wdStory
CreateNewDoc_Exit:
Exit Sub
CreateNewDoc_Error:
ReportError Err
GoTo CreateNewDoc_Exit
End Sub ' CreateNewDoc
Public Sub InitCallBack(fDummy As Boolean)
Dim i As Integer
Dim objCallBackLabels As BalloonLabels
On Error GoTo ErrorCallBack
If Not (fBlnInitialized) Then
Set objPostWizBln = Assistant.NewBalloon
fBlnInitialized = True
With objPostWizBln
.Heading = strCallBackHeading
.Mode = msoModeModeless
.Button = msoButtonSetCancel
.BalloonType = msoBalloonTypeButtons
.Callback = "Calendar.fnCallBack"
End With
Set objCallBackLabels = objPostWizBln.Labels
objCallBackLabels.Count = iCALL_BACK_COUNT
For i = 1 To iCALL_BACK_COUNT
objCallBackLabels.Item(i).Text = rgstrCallBackMsg(i - 1)
Next i
End If
objPostWizBln.Show
If (Assistant.BalloonError) Then GoTo ErrorCallBack
fPostWizBlnOpen = True
Set objDocBln = ActiveDocument
Set clsBln.app = Application
ActiveDocument.Variables.Add strPOST_WIZ_BLN, "1"
Exit Sub
ErrorCallBack:
DisplayErrorMsg strERR_INIT_CALL_BACK
fPostWizBlnOpen = False
Set objDocBln = ActiveDocument
Set clsBln.app = Application
ActiveDocument.Variables.Add strPOST_WIZ_BLN, "0"
End Sub
Public Function fnCallBack(objBln As Balloon, iBtn As Integer, lPrivate As Long)
On Error GoTo ErrorCallBack
Select Case iBtn
Case Is < 1 'Exit
objBln.Close
fPostWizBlnOpen = False
ActiveDocument.Variables(strPOST_WIZ_BLN).Value = "0"
RestoreAssistant (True)
Case 1 'Remove existing picture
DisplayTip rgstrCallBackTip(0)
Case 2 'Enter information into calendar
DisplayTip rgstrCallBackTip(1)
Case 3 ' Get help
Assistant.Help
End Select
Exit Function
ErrorCallBack:
DisplayErrorMsg Err.Description
End Function
Private Function StrBuildAutoTextName(fDummy As Boolean) As String
Dim strATName As String
On Error GoTo BuildAutoTextName_Error
'Select base AutoText Name NOTE: DO NOT LOCALIZE
Select Case iCalendarStyle
Case wzBOXES
strATName = "Boxes"
Case wzBANNER
strATName = "Banner"
Case wzJAZZY
strATName = "Jazzy"
End Select
strATName = strATName & CStr(Abs(formWizard.optLandscape.Value))
strATName = strATName & CStr(Abs(formWizard.optPictureNo.Value))
StrBuildAutoTextName = strATName
BuildAutoTextName_Exit:
Exit Function
BuildAutoTextName_Error:
StrBuildAutoTextName = ""
Resume BuildAutoTextName_Exit
End Function
'displays a tip during post-wizard options
'assumes that Assistant is present since it is called from post-wizard balloon
Private Sub DisplayTip(strTip As String)
Dim objBlnTip As Balloon
On Error GoTo FatalError
Set objBlnTip = Assistant.NewBalloon
With objBlnTip
.Mode = msoModeModal
.Heading = strWizName
.Text = strTip
.Button = msoButtonSetOK
End With
objBlnTip.Show
If Assistant.BalloonError <> msoBalloonErrorNone Then GoTo FatalError
Exit Sub
FatalError:
Err.Clear
End Sub
Thank you once again for all your help!! Very much appreciated. :D -
SelectInputDate set first day of week
Hi all! I was trying to change the first day of week showed in the calendar (Ex. set the first day the Monday) but i dont find any results :(
Someone know how to change it?
Many thanks.
Jose.Hi Jose, <br>
<br>
Unfortunately, this is not possible in JDeveloper 10.1.3<br>
See "<a href="http://blogs.oracle.com/Didier/2007/02/26#a218"> Setting the First Day of the Week to Monday in the SelectInputDate component</a>" for more details. <br>
<br>
Regards, <br>
<br>
Didier.<br>
<br> -
Function module for getting starting day of a week form current data
Hi ,
Is there any function module that gives starting day of week when we give a particular date
eg: today date is 19-12-2007
if i give this date as input i should get 16-12-2007 because this is starting day of this week .Hi,
Use FM GET_WEEK_INFO_BASED_ON_DATE
You will get the first day of the week in export parameter MONDAY
Lokesh -
I am trying to find out if I can change a setting of the calendar in my iPhone.
When I view calendar, in month, I would like to view it with the starting day of the week being Monday, not Sunday. Is it possible to make this change?Hello SMEvans32
You can use iCloud to share the Calendar, that way she will always be up to date on that particular section of your work calendar. If you want to use iCloud, I would recommend backing up so you have a safe copy of your data.
iCloud: Calendar sharing overview
http://support.apple.com/kb/PH2689
iCloud Setup
http://www.apple.com/icloud/setup/
Thanks for using Apple Support Communities.
Regards,
-Norm G. -
Dear apple,
The governments of Saudi Arabia has changed its weekend from THR&FRI to FRI&SAT,
Therefore the start day of the week became SUN. unfortunately all Iphone user could not adjust this change on their I phones .
So will you please facilitate us on this matter.
RegardsGive apple feedback regarding this.
For a temporary fix, change your region? Get a 3rd party Calendar app that fits your needs?
I assume your current region is set in the photo?
If so, pick a region that has a start day of Sunday. (either historically or known for the present)
Note, with changing your region, it will change the default phone number prefix/country code for new contacts and addresses. (calling and SMS is not affected) -
APO-SCM5 Configuring the Start Day of the week (e.g., Monday)
Where can we configure the start day of the week (e.g., Monday or Sunday). When we release DP to SNP, order category FA=FC Reqs are falling on Monday. I am being asked where this is set at we have seen disturbing results where some location-producta have FC Reqs on Monday and some Sunday. We are trying to determine if there is some sort of bug in SCM 5 as in APO4.0 all FC Reqs fell on a Monday at time= 00:00:00
Message was edited by:
Dan SpiethHi,
You can use planning calendar (T.code md25) to define the start of the day Eg:mon/tue/wed etc.
Regards,
SDS -
Regarding Start day of the week
Suppose in a program if User enters the start day of the week be 'Tuesday', then I have to get that day of the week as '1' and end the week with 'Monday' i.e the '7'. Is there any Query or NLS_Parameter setting?
Hi,
Since Tuesday is 1 day after the start of the ISO week,
TRUNC (dt) - TRUNC (dt - 1, 'IW')will be an integer in the range 1-7, where 1 means dt was a Tuesday, and 7 means dt was a Monday.
This does not depend on NLS settings.
NLS_TERRITORY controls which day of the week
TO_CHAR (dt, 'D')will be '1', but all the settings I know of make that Saturday, Sunday or Monday. I don't know if there's a value that makes it Tuesday. -
Apple calendar week start day error
Does anyone know why Apple has selected the Asia Pacific region calendar default week start day as Sunday? The beginning of the week is Monday in all countries I am aware of in this region. Microsoft outlook lets you manually select which day you wish to display as the first day of the week. But apple does not allow this. I have called apple support and they told me there is nothing that can be done as they don't have the functionality to have a manual select option. However when I asked them why the default setting is Sunday instead of Monday, their answer was that this is the standard for all of Asia pacific. Which is incorrect. Do you think there is anyone that can be done to change this?
Bout all you can do is tell apple
http://www.apple.com/feedback/
You won't get a response, but at least the issue is logged. -
Hi,
where you set the start day in factory calenderHi,
Please refer this thread,
Fctory calender
Regards,
R.Brahmankar -
Is there a way to change the start day for the week?
So I really like the "Insert Categories from the following" functionality of the Reorganize tool, and I fell in love with it's ability to break down by date automagically. I've encountered one problem with my use of it, though: I start my "work week" on Sunday, and it defaults to Monday as the first day of a week without any seeming way to change it to Sunday. Is there a way to do this?
Hi Christopher,
The WEEKDAY function allows specifying either Sunday or Monday as the first day of the week:
WEEKDAY
The WEEKDAY function returns a number that is the day of the week for a given date. WEEKDAY(date, first-day)
 date: The date the function should use. date is a date/time value. The time portion is ignored by this function.
 first-day: An optional value that specifies how days are numbered.
Sunday is 1 (1 or omitted): Sunday is the first day (day 1) of the week and Saturday is day 7.
Monday is 1 (2): Monday is the first day (day 1) of the week and Sunday is day 7. Monday is 0 (3): Monday is the first day (day 0) of the week and Sunday is day 6.
But I think you are referring to the first day of the 'workweek', for which I do not see a means of defining a custom value.
Since you want to 'insert categories', though, you could easily define your own, using WEEKDAY(date) or WEEKDAY(date,1), plus an IF statement to return the category label appropriate to the day. Here's one for a Sunday to Thursday work week. Dates are in column A, the formula is in whichever column you want as the Category column. For the example, I've placed it in column B.
B2, and filled down: =IF(WEEKDAY(A)<6,"Work","Off")
The top table shows the weekday numbers returned for each day of the week for each of the three permitted values for the optional second argument. The bottom table shows the results from the formula above, used to define a category label for each date:
A10 was left blank intentionally, to determine if the lack of data resulted in an error. The Warning message, flagged by the blue 'warning' triangle, is "The formula uses a number in place of a date." The 'date' assigned to this numerical value of zero was a Friday, but I'm not certain when. Probably best to avoid extra rows with no date shown.
Regards,
Barry -
I set iCloud up last week and the next day when out in the field I could not get Outlook to open up. I want to change my settings so I can get mail at home or in the field, not just when i'm at home. I have a PC and fios internet with Verizon at home. I have a Sprint air card in the field or access an available wifi. I want to change my settings to allow for receiving email in the field. What's the point of an air card and icloud for backup fi it doesn't work in the field for some odd reason?
Apple - Support - Mail Setup Assistant
-
OS 4.5 Calendar set day of week does not work
Hello,
the following code does not set the day of the week in der calendar object:
Calendar c = Calendar.getInstance();
c.set(Calendar.DAY_OF_WEEK, 8);
c.set(Calendar.HOUR_OF_DAY, 23);
c.set(Calendar.MINUTE, 59)
After call c.set(Calendar.DAY_OF_WEEK, 8); the date will be still the same. Is it a bug in the API? The hour of day and minute will set to 23 respective 59.
This problem seems to be only in 4.5 . It doesnt work with my device (os 4.5.0.124) and with the simulator (os 4.5.0.44).
With the os versions 4.7 and higher the above code works fine.
Someone an idea what's wrong?
regards,
AndreasCan anyone reproduce this error?
-
Change Starting Day of the Week to Sunday
Hi,
DBMS_SCHEDULER is assuming that Monday is the starting day of the week.
Can this behavior be changed ? I need Sunday to the be starting day of the week.
Regards,
SalimSo to start at 8am on sunday :
start_date => next_day(trunc(sysdate),'Sunday') + 8/24OR
begin
dbms_scheduler.create_schedule
(schedule_name => 'INTERVAL_DAILY_800',
start_date => next_day(trunc(sysdate),'Sunday') + 8/24,
repeat_interval=> 'FREQ=DAILY; BYDAY= SUN,MON,TUE,WED,THU,FRI,SAT; BYHOUR=08;',
comments=>'Runtime: Every day (Sun-Sat) at 08:00 o'clock');
end;
/Best Regards
mseberg -
How can I change the start day of the week for weekly view?
How can I change the start day of the week for weekly view?
<P>
This function is configured in the code in file <loadpoint>/CalendarServer/cal/uicust/en/main.html:
<P>
i18n['def first day'] = '1';
<P>
Note: 0 is Sunday, 1 is Monday, etc.Click system perferences below ur screen then click language&text and you just select ur peference langauge
Maybe you are looking for
-
Error executing batch file within web application
Hi all, I am trying to execute a batch file from within my web application (struts 1.2). The batch file is being kept inside the 'src' folder. The batch file contains only one command to open NOTEPAD. The code inside my Action class is: URL url = get
-
My bluetooth is keep on searching it is not working please help me
My bluetooth does not working it is keep on searching, is there any other setting do i need to do or any apps need to be install..? please help me
-
Why is the screen in my liquify page blank/white? I used to be able to see the picture
Why is the screen in my liquify page blank/white? I used to be able to see the picture I was working on but now it just shows a white page... I have photoshop CS4. How do I fix it?
-
Error page option OPEN IN NEW WINDOWS Iview
hi I have a problem all iviews in the portal have the option OPEN IN NEW WINDOWS this works from inside when connect from intranet works, but when connect to the portal from internet the functionality OPEN IN NEW WINDOWS gives me an error page when
-
Can I use OVM templates with VirtualBox
Oracle has lots of OVM templates available on edelivery for Oracle E-Business Suite. But it seems that to get those I need to install OVM and would not just work with VirtualBox. Is there a possibility that I can use them directly with VirtaulBox ins