Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    get filename BEFORE open (WORD 97/2000/...)

    Hi,

    BTW: This is important but not extremely urgent so please do not waste your time if there isn't a simple solution.

    I would like to get the name of the file the user want to open and set its attribute to NORMAL before processing it. Is this possible - i.e. get the name of the before opening it. My code is as follows:

    This is my scenario:

    ' Select and open the file to convert
    With Dialogs(wdDialogFileOpen)
    .Name = "*.doc"
    If .Display = 0 Then
    Exit Function
    End If
    '
    ' Get the name of file selected for opening & set the attribute to normal for the document to open
    '
    ' Open the document & process further
    .Execute
    etc
    etc
    End With

    Thanks.

    Robie
    Thanks.
    Robie

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: get filename BEFORE open (WORD 97/2000/...)

    I'm not sure what you mean by "set its attribute to NORMAL". If you want to set a file attribute such as Read-Only, that is possible, for example to clear the Read-Only flag:

    ...
    Dim strFile As String
    strFile = .Name
    With CreateObject("Scripting.FileSystemObject").GetFile (strFile)
    If .Attributes And 1 Then
    .Attributes = .Attributes - 1
    End If
    End With
    ...

    If you want to set the attached template to Normal.dot, that is not possible without opening the document.

  3. #3
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Tallahassee, Florida, USA
    Posts
    901
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: get filename BEFORE open (WORD 97/2000/...)

    The only other "normal" I can think of is Normal View. If so, you can create an AutoOpen macro in your normal... but this will only affect documents that you open which are based on normal.dot. If that's what you're looking for then you can do it with this code:

    <pre>Sub AutoOpen()
    ' AutoOpen Macro
    ' Macro created 3/14/2005 by Karen MacKenzie
    '
    With ActiveDocument
    If ActiveWindow.View.SplitSpecial = wdPaneNone Then
    ActiveWindow.ActivePane.View.Type = wdNormalView
    Else
    ActiveWindow.View.Type = wdNormalView
    End If
    End With
    End Sub
    </pre>


    I hope this helps!
    Karen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •