Re: Save Document oddity

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



What it sounds like is depending on what version of Word you are opening
first, the VB object for that version is loading in memory and sticking.
Being on my first cup of coffee here I can't help, but you may need to
manually init the VB object. In VB Editor check to see what references are
loaded.

Jeff
OJD

"Graham Mayor" <gmayor@xxxxxxxxxxxxxxxxxx> wrote in message
news:uLjaGmvtHHA.4688@xxxxxxxxxxxxxxxxxxxxxxx
While I am still talking to myself, I have found a workaround

If Len(.Path) = 0 Then
.Save
End If

for the saved test,
(and before anyone comments I do know about .path for the original
macro -
it was just part of an example)

but I am still puzzled by the original failure.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Graham Mayor wrote:
Testing further
Sub Saved()
If ActiveDocument.Saved = False Then _
MsgBox ("Not Saved")
If ActiveDocument.Saved = True Then _
MsgBox ("Saved")
End Sub
always shows 'Saved' here and if I run 2007 before 2003 it always
shows Saved there too. If I reboot, Word 2003 alone responds
correctly?

Graham Mayor wrote:
I have used macros similar to the following to insert (in this
instance) the path at the foot of a document. However testing this in
Word 2007 has thrown up an anomaly in that the check for whether the
document is saved is completely ignored inevitably causing an error
at the line pPathname= if the document has not already been saved.

This always worked in Word 2003, however on testing again in Word
2003 (my PC currently has both Word 2003 and 2007 installed in
parallel) it no longer worked there either.

Following a reboot, it worked again in 2003, but not in 2007, and
then on closing 2007 and reopening 2003 it no longer works there.
Reboot and open 2007 without first opening 2003 and it still doesn't
work :(
Initially I thought that the presence of both versions was the
problem, but my laptop only has 2007 and it doesn't work there
either. Any ideas?
I am trying to like 2007 ..... honest .... but it seems to throw up
one problem after another.

On an entirely different note my laptop's Word 2007 has an AddIns tab
on the Ribbon, that of my desktop doesn't. My desktop has Acrobat 8.1
instead. I guess that may be getting in the way, in the inimitable
manner Adobe has of screwing with Word :( ?

Sub InsrtPath()
Dim pPathname As String
Dim pFoldername As String
With ActiveDocument
If Not .Saved Then
.Save
End If
pPathname = Left$(.FullName, (Len(.FullName) - Len(.Name) -
1)) pFoldername = Right$(pPathname, (Len(pPathname) -
InStrRev(pPathname, "\")))
End With
Selection.TypeText pPathname
End Sub




.



Relevant Pages

  • Re: Save Document oddity
    ... If I reboot, ... Sub InsrtPath() ... Dim pPathname As String ... Dim pFoldername As String ...
    (microsoft.public.word.vba.general)
  • Re: Save Document oddity
    ... Graham Mayor - Word MVP ... Sub Saved() ... If I reboot, Word 2003 alone responds ... Dim pPathname As String ...
    (microsoft.public.word.vba.general)
  • Re: Macro stops when one a file
    ... I put a delay of two seconds prior to opening the file and that seems to ... how a sub could close before all of its statements have executed. ... Dim invwkbname As String ... ' If I set a break here and hit F5 the macro completes ...
    (microsoft.public.excel.programming)
  • Re: WARNING: KB942615 may require an extra reboot to apply correctly
    ... tried reopening IE6 until it would successfully open. ... The above occurred when opening my default homepage, ... I suspect the KB942615 update should be coded to force a reboot ... installing this update without the reboot causes IE6 ...
    (microsoft.public.windowsupdate)
  • Re: Maximize on load or open
    ... Debug.Print " Loading at " & Time ... Private Sub Form_Open ... Debug.Print " Opening at " & Time ... Opening the form displays the following in the Immediate Window: ...
    (comp.databases.ms-access)