GRox
Thu Mar 16 00:24:27 CST 2006
That's nearly what I am doing now (fighting a vba-bug with a wordbasic-bug,
isn't it ?!), unless I use
browsefile = .Name instead of browsefile =
WordBasic.FileNameInfo$(.Name, 1)
and no Cancel-Option.
Thanks again - and: I'll promise to improve my English ;-)
"Doug Robbins - Word MVP" schrieb:
> Thanks for posting back with this information. You may then want to modify
> the code so that it replicates what happens when the document is opened
> manually, giving the Yes, No or Cancel options:
>
> Dim doc As Document
> With Dialogs(wdDialogFileOpen)
> If .Display <> -1 Then
> browsefile = ""
> Else
> browsefile = WordBasic.FileNameInfo$(.Name, 1)
> End If
> End With
> Set doc = Documents.Open(browsefile)
> If doc.ReadOnly = True Then
> Response = MsgBox(browsefile & "should be opened as Read only unless
> changes to it are to be saved. Open as read_only?", vbYesNoCancel +
> vbQuestion + vbDefaultButton1)
> If Response = vbNo Then
> doc.Close wdDoNotSaveChanges
> WordBasic.FileOpen Name:=browsefile
> ElseIf Response = vbCancel Then
> doc.Close wdDoNotSaveChanges
> End If
> End If
>
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
>
> "GRox" <GRox@discussions.microsoft.com> wrote in message
> news:D1E0E5D9-CDB4-43DB-ACE7-03FBAAC3B0C2@microsoft.com...
> > After several attempts I found out that even 'documents.open' ignores
> > 'ReadOnlyRecommended' (
http://support.microsoft.com/kb/275976/de). The
> > only
> > way seems to be using 'good old' WordBasic:
> >
> > So right after your 'doc.close' I now use
> >
> > WordBasic.FileOpen Name:="Filename.doc"
> >
> > so if the user says 'no' the document will be opened without any
> > protection
> > !?
> >
> > Thanks a lot for your help !
> >
> > "Doug Robbins - Word MVP" schrieb:
> >
> >> Sorry, I said it came close. I do not know how to change the setting
> >> using
> >> VBA.
> >>
> >> --
> >> Hope this helps.
> >>
> >> Please reply to the newsgroup unless you wish to avail yourself of my
> >> services on a paid consulting basis.
> >>
> >> Doug Robbins - Word MVP
> >>
> >> "GRox" <GRox@discussions.microsoft.com> wrote in message
> >> news:B7D266E9-3DDC-4273-BC99-3A79F4741F94@microsoft.com...
> >> > Sorry, but this doesn't ssem to work:
> >> > If the user agrees, the document is - still - write protected, and if
> >> > he
> >> > doesn't, the document will be closed without saving.
> >> >
> >> > My first attempt with doc.unprotect instead of doc.close doesn't work,
> >> > anyway ?
> >> >
> >> > While several users get a grip to the documents, I'd like the current
> >> > user
> >> > to decide, wether or not he wants the choosen document to be edited or
> >> > not -
> >> > but this doesn't seem to work ?
> >> >
> >> > Have you got any ideas or further hints for me ?
> >> >
> >> > "Doug Robbins - Word MVP" schrieb:
> >> >
> >> >> The following comes close to presenting the user with the same choices
> >> >> as
> >> >> if
> >> >> the document was opened manually
> >> >>
> >> >> Dim doc As Document
> >> >> With Dialogs(wdDialogFileOpen)
> >> >> If .Display <> -1 Then
> >> >> Browsefile = ""
> >> >> Else
> >> >> Browsefile = WordBasic.FileNameInfo$(.Name, 1)
> >> >> End If
> >> >> End With
> >> >> Set doc = Documents.Open(Browsefile)
> >> >> If doc.ReadOnly = True Then
> >> >> Response = MsgBox(Browsefile & "should be opened as
> >> >> ReadabilityStatistic-only unless changes to it are to be saved. Open
> >> >> as
> >> >> read_only?", vbYesNo + vbQuestion + vbDefaultButton1)
> >> >> If Response = vbNo Then
> >> >> doc.Close wdDoNotSaveChanges
> >> >> End If
> >> >> End If
> >> >>
> >> >>
> >> >> --
> >> >> Hope this helps.
> >> >>
> >> >> Please reply to the newsgroup unless you wish to avail yourself of my
> >> >> services on a paid consulting basis.
> >> >>
> >> >> Doug Robbins - Word MVP
> >> >>
> >> >> "GRox" <GRox@discussions.microsoft.com> wrote in message
> >> >> news:AA158E45-374A-423C-BECE-E6D932A5F5C0@microsoft.com...
> >> >> >I really need some helpful hints (Word 2000, VBA):
> >> >> >
> >> >> > I'm saving the documents with "ActiveDocument.SaveAs strFullPath &
> >> >> > "\"
> >> >> > &
> >> >> > strFileName, , , , , , True".
> >> >> >
> >> >> > Using the Menu-Item FileOpen or the Windows-Explorer, the dialog
> >> >> > referring
> >> >> > to the "ReadOnlyRecommended"-property is properly shown.
> >> >> >
> >> >> > The vba command "Dialogs(wdDialogFileOpen).Show" always opens the
> >> >> > document
> >> >> > write-protected without asking the user what to do !?
> >> >> >
> >> >> > Is there any way to ask the user for a decision using the
> >> >> > wdDialogFileOpen
> >> >> > ?
> >> >> >
> >> >> > Thanks a lot !
> >> >> > Guido
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>