[mso] Re: Formula for excel dates

  • From: "Glenda Wells" <gwells@xxxxxxxxxxx>
  • To: <mso@xxxxxxxxxxxxx>
  • Date: Fri, 6 May 2005 10:00:34 -0400

Can you use fill?  Enter the first value then click the handle around
the cell and drag to the direction you want to fill incremental data.=20

-----Original Message-----
From: Peter A. Wilson [mailto:pawilson@xxxxxxxxxxxxxxxxxx]=20
Sent: Thursday, May 05, 2005 11:31 AM
To: mso@xxxxxxxxxxxxx
Subject: [mso] Formula for excel dates

How do I get the dates to enter into excel for consecutive days.....
Like 5/5/05 and then hit enter or tab and the next day of the week comes
up 5/6/05

=3D20


Peter Wilson, CCNA
Network Administration/Support
Heritage-Encon Inc
704-588-1366 (W)
704-451-0596 (C)=3D20

-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx] On
Behalf Of Ray Blake
Sent: Thursday, May 05, 2005 10:54 AM
To: mso@xxxxxxxxxxxxx
Subject: [mso] Re: Still Requiring Help with a Word Macro

What do you mean by "It doesn't work"? Do you get an error message of
any kind? How are you calling the macro?

Ray

------------------------------------
GR Business Process Solutions
Ray Blake
Head of Software Design
ray@xxxxxxxxx
Braedon
Newell Road
Hemel Hempstead
Herts HP3 9PD
tel: 01442 396518
fax: 01442 389353
mobile: 07834 226601
www.grbps.com
------------------------------------


-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx] On
Behalf Of rmshah@xxxxxxxxx
Sent: 05 May 2005 15:48
To: mso@xxxxxxxxxxxxx
Subject: [mso] Still Requiring Help with a Word Macro


Hi,

I truly apologize for resending this message, but I seem to be going
round circles with this particular macro.

I have created (or rather modified) a Word 2000 macro for running the
spell checker in a protected Word form. (I am also not a VBA
expert--just learned a little several days ago for this task. It worked
one time, but I can't get it to work agin. I have attached it to the
Normal.dot template.

For your reference, I have attached the code below. Any help would be
appreciated at the earliest.
Thanks in advance.

Regards,


Rajiv

[Code Snippet follows]


Option Explicit

Dim Cancelled As Boolean, MyRange As Range, _ CorrectedError As String,
oDoc As Document

Sub RunSpellcheck()

Dim oSection As Section, OriginalRange As Range

'If no documents open, quit macro
If Documents.Count =3D3D 0 Then
Exit Sub
End If

Set oDoc =3D3D ActiveDocument

'Check what type of protection - if any - has been applied Select Case
oDoc.ProtectionType

'If not protected, or if protected for tracked changes, 'run
spellchecker and quit
'-------------
Case wdNoProtection, wdAllowOnlyRevisions If
Options.CheckGrammarWithSpelling Then oDoc.CheckGrammar Else
oDoc.CheckSpelling End If Application.ScreenUpdating =3D3D True
Application.ScreenRefresh If oDoc.SpellingErrors.Count =3D3D 0 Then If
Options.CheckGrammarWithSpelling Then MsgBox "The spelling and grammar
check is complete", _ vbInformation Else MsgBox "The spelling check is
complete", vbInformation End If End If System.Cursor =3D3D =
wdCursorNormal
Exit Sub
'-------------
Case wdAllowOnlyComments
'Don't want to run spellchecker if protected for comments Exit Sub End
Select

Set OriginalRange =3D3D Selection.Range
System.Cursor =3D3D wdCursorWait

'-------------
'-------------
'If we've got this far, it's protected for forms 'Now unprotect the
document oDoc.Unprotect oDoc.SpellingChecked =3D3D False

'Check each section for its protection property - 'which you can get
even after unprotecting the document.
'If the section was protected, call a subroutine to spellcheck the
formfields.
'if it wasn't, spellcheck the section
StatusBar =3D3D "Spellchecking document ..."
For Each oSection In oDoc.Sections
If oSection.ProtectedForForms Then
Call CheckProtectedSection(oSection)
If Cancelled Then
'Boolean variable returned by CheckProtectedSection 'procedure if user
pressed Cancel button Exit For End If Else If
oSection.Range.SpellingErrors.Count > 0 Then Application.ScreenUpdating
=3D3D True oSection.Range.CheckSpelling If
oSection.Range.SpellingErrors.Count > 0 Then 'User pressed Cancel button
'(Pressing Ignore reduces the count, pressing Cancel doesn't) Exit For
End If End If End If Next oSection

'Re-protect the document
oDoc.Protect Type:=3D3DwdAllowOnlyFormFields, NoReset:=3D3DTrue
OriginalRange.Select Application.ScreenUpdating =3D3D True
Application.ScreenRefresh If oDoc.Range.SpellingErrors.Count =3D3D 0 =
Then
=3D If Options.CheckGrammarWithSpelling Then MsgBox "The spelling and
grammar check is complete", _ vbInformation Else MsgBox "The spelling
check is complete", vbInformation End If End If

'Release variables from memory
System.Cursor =3D3D wdCursorNormal
Cancelled =3D3D False
CorrectedError =3D3D vbNullString
Set MyRange =3D3D Nothing

End Sub


'-----------------------------------------------------------------------
---------

Private Sub CheckProtectedSection(oSection As Section)

Dim FmFld As FormField, FmFldCount As Long, Pos As Long

'check only the text formfields,
'don't check listboxes and checkboxes - this speeds up the code
Application.ScreenUpdating =3D3D False For Each FmFld In
oSection.Range.FormFields 'Check to see if the field is a text formfield
If FmFld.Type =3D3D wdFieldFormTextInput Then 'Check if the field is a
'real' text field (no date, formula etc); 'and that it is enabled for
text input If FmFld.TextInput.Type =3D3D wdRegularText And FmFld.Enabled
Then 'The following subroutine won't be called if Word 97 is in use If
Not Left$(Application.Version, 1) =3D3D "8" Then Call
TurnNoProofingOff(FmFld) End If FmFld.Range.SpellingChecked =3D3D False

'Change the language constant in the following line if necessary; 'when
you type the =3D3D sign, a list of all supported language 'constants =
will
appear, and you can choose one from the list.
FmFld.Range.LanguageID =3D3D wdEnglishUS
'Or whichever language is appropriate for you

'If the current form field contains errors, spellcheck the text in it If
FmFld.Range.SpellingErrors.Count > 0 Then 'The following condition is to
allow for a Word 97 bug, which 'was fixed in 2000; (and in the latest
Word 97 patches). If 'the formfield is in a table and contains more than
one 'paragraph, then spellchecking it will crash Word 97 If
Left$(Application.Version, 1) =3D3D "8" _ And =
FmFld.Range.Paragraphs.Count
=3D
>
1 _ And FmFld.Range.Tables.Count > 0 Then Call
Word97TableBugWorkaround(FmFld) If Cancelled Then Exit Sub Else 'Set a
range to the formfield's range in case the user 'accidentally destroys
the formfield by overtyping its entire 'contents Set MyRange =3D3D
FmFld.Range FmFldCount =3D3D oSection.Range.FormFields.Count
Application.ScreenUpdating =3D3D True

FmFld.Range.CheckSpelling

If IsObjectValid(FmFld) Then
If FmFld.Range.SpellingErrors.Count > 0 Then 'User pressed Cancel
button. (Pressing Ignore 'reduces the count, pressing Cancel doesn't)
Cancelled =3D3D True Exit Sub End If Else 'If formfield was destroyed
because user overtyped its 'entire contents CorrectedError =3D3D
MyRange.Text If Len(CorrectedError) =3D3D 0 Then CorrectedError =3D3D
MyRange.Words(1).Text End If

'Formfields should really NEVER be preceded by a tab; 'design your forms
so that each formfield is in its own 'table cell (removing borders as
necessary). However, to 'cater for any legacy forms you may have, the
following 'loop works around the possibility that it might be 'preceded
by a tab Pos =3D3D InStr(CorrectedError, vbTab) Do While Pos > 0
CorrectedError =3D3D Mid$(CorrectedError, Pos + 1) Pos =3D3D
InStr(CorrectedError, vbTab) Loop

'If formfield was destroyed when the user corrected the 'spelling,
reinstate it, and put the user's correction into its 'result. Note that
although Undo reinstates the Formfield 'itself, if the Formfield is
preceded by a tab, It doesn't 'reinstate the FmFld object, hence the
need to do a count '(although, as previously stated, in a well-designed
form, 'formfields should never be preceded by a tab, as it's 'better use
table cells (removing borders as necessary).
Do While Not FmFldCount =3D3D _
oSection.Range.FormFields.Count
oDoc.Undo
Loop

'Also due to a Word bug, if the formfield is preceded by a 'tab, the
text within the formfield may now be selected 'without the formfield
itself being selected!
'Hence the following convoluted workaround If Selection.FormFields.Count
=3D3D 0 Then Selection.MoveRight unit:=3D3DwdCharacter =
Selection.MoveLeft
unit:=3D3DwdCharacter, Extend:=3D3DTrue End If If Not =
IsObjectValid(FmFld) =3D
Then Set FmFld =3D3D  Selection.FormFields(1) End If FmFld.Result =3D3D
CorrectedError End If End If Application.ScreenUpdating =3D3D False End =
If
End If End If Next FmFld

End Sub


'-----------------------------------------------------------------------
---------

Private Sub TurnNoProofingOff(FmFld As FormField) 'This subroutine is
called only in Word 2000 and above FmFld.Range.NoProofing =3D3D False =
End
Sub


'-----------------------------------------------------------------------
---------

Private Sub Word97TableBugWorkaround(FmFld As FormField)

'Unlink formfield (convert to text)
Set MyRange =3D3D FmFld.Range
FmFld.Range.Fields(1).Unlink
Application.ScreenUpdating =3D3D True
MyRange.CheckSpelling
If MyRange.SpellingErrors.Count > 0 Then 'User pressed Cancel button
'(Pressing Ignore reduces the count, pressing Cancel doesn't) Cancelled
=3D3D True End If CorrectedError =3D3D MyRange.Text 'Undo to reinstate =
the
formfield Do While Not IsObjectValid(FmFld) oDoc.Undo Loop
FmFld.Range.Fields(1).Result.Text =3D3D CorrectedError
Application.ScreenUpdating =3D3D False

End Sub



*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx
or MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the
quotes) in the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will
also allow you to change your email settings to digest or vacation (no
mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group,
send a request to mso-moderators@xxxxxxxxxxxxx and you will be sent an
invitation with instructions.  Once you are a member of the files group,
you can go here to upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx
or MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the
quotes) in the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will
also allow you to change your email settings to digest or vacation (no
mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group,
send a request to mso-moderators@xxxxxxxxxxxxx and you will be sent an
invitation with instructions.  Once you are a member of the files group,
you can go here to upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: