Hi all,
I am not quite new to VBA in a practical sense.
I have been working on this macro today but I cant seem to get it to paste for some reason, It was intended to open hyperlinked documents from a excel file, within this document is a word table, from which I run a macro to copy the desired information, but when I come to putting this information back into the Excell sheet. It does not work. If I run the macro without the paste section and manually paste it - it works. See below:
Excel Macro
Word Macro
Any input would be greatly appreciated.
I am not quite new to VBA in a practical sense.
I have been working on this macro today but I cant seem to get it to paste for some reason, It was intended to open hyperlinked documents from a excel file, within this document is a word table, from which I run a macro to copy the desired information, but when I come to putting this information back into the Excell sheet. It does not work. If I run the macro without the paste section and manually paste it - it works. See below:
Excel Macro
Code:
Option Explicit
Sub odoc()
Dim fpath As String
Dim objWord As Object
Set objWord = CreateObject("Word.Application")
fpath = Application.ActiveCell.Value
objWord.Documents.Open (fpath)
objWord.Visible = True
objWord.Application.Run MacroName:="CopySAM"
objWord.Application.Quit
ActiveCell.Offset(0, 14).Select
ActiveSheet.Paste
End Sub
Word Macro
Code:
Sub CopySAM()
Dim tbl1 As Table
Set tbl1 = ActiveDocument.Tables(1)
tbl1.Cell(4, 2).Range.Copy
End Sub
Any input would be greatly appreciated.
Last edited: