Hi,
I'm new to VBA and I'm attempting to find a macro that will allow me to attach a file to my workbook. I found this code on this forum, but it appears to only link to a file path, rather than actually attaching the document.
Any help would be greatly appreciated!
(By the way, did I put the correct tags around the VB??)
Regards,
Marty
I'm new to VBA and I'm attempting to find a macro that will allow me to attach a file to my workbook. I found this code on this forum, but it appears to only link to a file path, rather than actually attaching the document.
Code:
Sub Button14_Click()
Dim strFilename As String
Dim strShortName As String
strFilename = Application.GetOpenFilename("All Documents (*.*), *.*")
If strFilename = "False" Then
Exit Sub ' user cancelled
End If
strShortName = InputBox("What do you want to call this link?", "Short Text", strFilename)
ActiveSheet.Hyperlinks.Add Anchor:=Range("D36"), Address:=strFilename, TextToDisplay:=strShortName
End Sub
Any help would be greatly appreciated!
(By the way, did I put the correct tags around the VB??)
Regards,
Marty