1

Currently I'm having an issue with WordBasic my company recently decided to update their system from 2007 to Word 365 but, according to Google, WordBasic is a relic from Word 97 which no longer works on Word.

I need to retrieve the directory of where I saved my file but can't seem to find an alternative to my current (was working) code.

With Dialogs(wdDialogFileSaveAs)
    .Name = Jobnumber & " " & Jobname & " FDS V0_00.docx"
    .Show
    Dim Directory As String
    Directory = WordBasic.filenameinfo(.Name, 5)
End With
Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
Alex Gale
  • 55
  • 1
  • 7

2 Answers2

0

In word 2007 you are using VBA. The word WordBasic refers to an Object in the VBA library:

enter image description here

This object was probably built with some of the old properties of the old WordBasic, but you should not care about this, as far as VBA is the one to handle it.

This code works for me in word 2016:

Option Explicit

Sub TestMe()

    With Dialogs(wdDialogFileSaveAs)
        .Name = 1 & " " & 2 & " FDS V0_00.docx"
        .Show
        Dim Directory As String
        Directory = WordBasic.filenameinfo(.Name, 5)
    End With

End Sub

If for any reason it does not work, try Directory = Word.Global.WordBasic.Filenameinfo(.Name, 5)

Vityata
  • 42,633
  • 8
  • 55
  • 100
0

In VBA you should be able to use the Path property of the Document object:

Directory = ActiveDocument.Path
Cindy Meister
  • 25,071
  • 21
  • 34
  • 43