Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
LINKING CELL VALUES IN A EXCEL SHEET TO EMBEDDED WORD DOCUMENT Prasad Gopinath Excel Discussion (Misc queries) 0 February 13th 07 08:34 PM
Linking a Specific Word to a Specific Number [email protected] Excel Worksheet Functions 1 July 11th 06 05:55 PM
Linking a Specific Word to a Specific Number [email protected] Excel Worksheet Functions 2 July 11th 06 05:50 PM
Linking a Specific Word to a Specific Number [email protected] Excel Worksheet Functions 1 July 11th 06 04:29 PM
Linking Excell values to word document Kent Links and Linking in Excel 0 January 17th 06 08:56 PM


All times are GMT +1. The time now is 04:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"