![]() |
#1
|
|||
|
|||
![]()
Hello
I am using this code to select a file an run a macro, but the code returns the full path. How can I get just the filename? I need to use the same file name that was opened but the path will be different? do I need to parse or is there a method to return just the file name Dim FileToOpen As String Dim FileOpenName As String Dim SaveName As String ' Set the default directory. ' Note: Substitute any existing directory. Options.DefaultFilePath(Path:=wdDocumentsPath) = "\\10.3.16.243\9105_boh" With Dialogs(wdDialogFileOpen) On Error Resume Next If .Display <> 0 Then FileToOpen = WordBasic.FileNameInfo(.Name, 1) Else MsgBox "No file selected" End If End With Documents.Open FileName:=FileToOpen, ConfirmConversions:=False, ReadOnly:= _ False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:= _ "", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", _ Format:=wdOpenFormatAuto |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
truncating path or renaming audio file to play in powerpoint | rbookend | PowerPoint | 0 | 05-02-2006 03:39 PM |