Reputation: 51
I'm trying to insert one word file to another word file and it's important that there's also a Link... So I found the option below
selection.InsertFile(FileName, Range, ConfirmConversions, Link, Attachment)
But my problem is that I need to add several files (hence using the macro) and I want to choose the file every time myself (not add the directory to the code). Is it somehow possible? I'm not familiar with the VBA syntax.
I could also just use Dialogs(wdDialogInsertFile).Show
But there I couldn't find a place where turn on the link option.
I hope sb can help me out.
Thanks!
Upvotes: 2
Views: 2458
Reputation: 91356
You can use an Inputbox ( http://www.functionx.com/vb/functions/inputbox.htm )
FileName = InputBox ("Enter file name")
Or even the FileDialog ( http://msdn.microsoft.com/en-us/library/aa163948(v=office.10).aspx )
With Application.FileDialog(msoFileDialogOpen)
.Filters.Clear
.InitialFileName = ""
.Title = "File Location"
.AllowMultiSelect = False
.Filters.Add "Word", "*.doc*, 1
.Filters.Add "All Files", "*.*", 2
.Show
If .SelectedItems.Count > 0 Then
FileName = .SelectedItems(1)
End If
End With
Upvotes: 1