Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
linking a averaged cell sum to a specific spot in a word document
how do i link an averaged cell to a specific spot in a word document, I tried
the copy then paste as a hyper link but it did not work. |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
linking a averaged cell sum to a specific spot in a word document
There are many ways to do this; this is probably the easiest:
Sub OpenAWordFile() Dim wordApp As Object Dim fNameAndPath As String ActiveSheet.Range("A1:A2").Copy fNameAndPath = "C:\Test\MyFile.doc" Set wordApp = CreateObject("Word.Application") With wordApp ..Documents.Open (fNameAndPath) ..Visible = True ..Selection.PasteSpecial DataType:=wdPasteText '.Selection.PasteAndFormat (wdPasteDefault) ..Selection.WholeStory ..Selection.Font.Name = "Arial" ..Selection.Font.Size = 11 End With Set wordApp = Nothing Application.CutCopyMode = False End Sub Notice: you must have a blank word file saved in this location: C:\Test\MyFile.doc You can give this a try too: Sub OpenAWordFile() Dim wdApp As Object Dim wdDoc As Object Dim fNameAndPath As String fNameAndPath = "C:\Test\MyFile.doc" ActiveSheet.Range("A1:D4").Copy On Error Resume Next Set wdApp = GetObject(, "Word.Application") If Err.Number < 0 Then Set wdApp = CreateObject("Word.Application") End If Err.Clear On Error GoTo 0 Set wdDoc = wdApp.Documents.Open(fNameAndPath) wdApp.Visible = True With wdDoc.Content ..Font.Name = "Arial" ..Font.Size = 11 ..PasteSpecial Link:=False, DataType:=wdPasteText, Placement:= _ wdInLine, DisplayAsIcon:=False End With End Sub Regards, Ryan--- -- RyGuy "Karyn" wrote: how do i link an averaged cell to a specific spot in a word document, I tried the copy then paste as a hyper link but it did not work. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
LINKING CELL VALUES IN A EXCEL SHEET TO EMBEDDED WORD DOCUMENT | Excel Discussion (Misc queries) | |||
Linking a Specific Word to a Specific Number | Excel Worksheet Functions | |||
Linking a Specific Word to a Specific Number | Excel Worksheet Functions | |||
Linking a Specific Word to a Specific Number | Excel Worksheet Functions | |||
Linking Excell values to word document | Links and Linking in Excel |