M
Marley
Can anyone help me please? I need a macro which allows me to insert text from
whichever file I choose from a directory.
The idea is to click on a toolbar icon > display the folder containing the
text files > select the text file > Click to insert file. The trouble is I
could do it on my home PC but could not do it on my work network.
I used the macro from a previous post and it was great but I seem to have
trouble with the insert part of the macro and it includes both the S: path
and the C: temp path when asking me if I'm sure this is the file I want.
Macro used:
Sub MySpecFileInsert()
defPath = Options.DefaultFilePath(wdDocumentsPath)
Options.DefaultFilePath(wdDocumentsPath) = "S:\Insert"
Set myDialog = Dialogs(wdDialogInsertFile)
If myDialog.Display = -1 Then
tempPath = Options.DefaultFilePath(wdDocumentsPath)
If tempPath = "s:\insert" Then
myDialog.Execute
Else
x = MsgBox("Are you sure you want to insert " & tempPath _
& "\" & myDialog.Name, vbYesNo)
If x = 6 Then
myDialog.Execute
End If
End If
End If
Options.DefaultFilePath(wdDocumentsPath) = defPath
End Sub
Thanks!
whichever file I choose from a directory.
The idea is to click on a toolbar icon > display the folder containing the
text files > select the text file > Click to insert file. The trouble is I
could do it on my home PC but could not do it on my work network.
I used the macro from a previous post and it was great but I seem to have
trouble with the insert part of the macro and it includes both the S: path
and the C: temp path when asking me if I'm sure this is the file I want.
Macro used:
Sub MySpecFileInsert()
defPath = Options.DefaultFilePath(wdDocumentsPath)
Options.DefaultFilePath(wdDocumentsPath) = "S:\Insert"
Set myDialog = Dialogs(wdDialogInsertFile)
If myDialog.Display = -1 Then
tempPath = Options.DefaultFilePath(wdDocumentsPath)
If tempPath = "s:\insert" Then
myDialog.Execute
Else
x = MsgBox("Are you sure you want to insert " & tempPath _
& "\" & myDialog.Name, vbYesNo)
If x = 6 Then
myDialog.Execute
End If
End If
End If
Options.DefaultFilePath(wdDocumentsPath) = defPath
End Sub
Thanks!