Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
[email protected] ryanadgriffith@hotmail.com is offline
external usenet poster
 
Posts: 2
Default Importing information from excel to word

Can anyone help me with a Macro, I have no experience in VBA at all.
I need a macro that will take a numerical value from a cell in excel
and put the vaule where ever I want it in word. Thanks for your help

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Importing information from excel to word

Depending on exactly what you need, you may not need a macro. Try...
a. in Excel, open the workbook, select the cell, then Edit|Copy
b. in Word, Edit|Paste Special and select "Paste Link". Then select one of
the options such as Plain text.

A { LINK } field is inserted into the Word document. The result of the LINK
field should be the value in the cell. If you modify the cell content, then
update the LINK field (e.g. by selecting it and pressing F9) the field
result should be updated. You should be able to put such a field most places
in a Word document (although there may be exceptions).

Peter Jamieson
wrote in message
oups.com...
Can anyone help me with a Macro, I have no experience in VBA at all.
I need a macro that will take a numerical value from a cell in excel
and put the vaule where ever I want it in word. Thanks for your help


  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
[email protected] ryanadgriffith@hotmail.com is offline
external usenet poster
 
Posts: 2
Default Importing information from excel to word

On Aug 2, 6:12 pm, "Peter Jamieson"
wrote:
Depending on exactly what you need, you may not need a macro. Try...
a. in Excel, open the workbook, select the cell, then Edit|Copy
b. in Word, Edit|Paste Special and select "Paste Link". Then select one of
the options such as Plain text.

A { LINK } field is inserted into the Word document. The result of the LINK
field should be the value in the cell. If you modify the cell content, then
update the LINK field (e.g. by selecting it and pressing F9) the field
result should be updated. You should be able to put such a field most places
in a Word document (although there may be exceptions).

Peter wrote in message

oups.com...



Can anyone help me with a Macro, I have no experience in VBA at all.
I need a macro that will take a numerical value from a cell in excel
and put the vaule where ever I want it in word. Thanks for your help- Hide quoted text -


- Show quoted text -


Thanks for your reply, but I dont want to do it that way because I
dont want the values to change everytime I change my excel work sheet.
I want a macro so when I run it, it takes the values from excel and
puts them into word

  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Importing information from excel to word

Well for that you would probably be better off looking in an Excel group for
a comprehensive macro that dealt with all situations (e.g whether or not the
sheet is closed, error handling etc.) but for example you could
a. set a reference to Microsoft Excel 11.0 Object Library (or whichever
version is appropriate)
b. use a function such as

Function getcellvalue(strWBPath As String, _
strWSname As String, _
lngRow As Long, _
lngColumn As Long)
Dim objExcel As Excel.Application
Dim objWB As Excel.Workbook
Dim objWS As Excel.Worksheet

Set objExcel = CreateObject("Excel.Application")
With objExcel
Set objWB = .Workbooks.Open(FileName:=strWBPath, ReadOnly:=True)
Set objWS = objWB.Worksheets(strWSname)
getcellvalue = objWS.Cells(lngRow, lngColumn).Value
Set objWS = Nothing
objWB.Close savechanges:=False
Set objWB = Nothing
End With
objExcel.Quit
Set objExcel = Nothing

End Function

c. call it using e.g.

msgbox getcellvalue("c:\myxlwbs\myxlwb.xls","mysheetname" ,23,3)

to get the value of row 23 column C

Peter Jamieson
wrote in message
ups.com...
On Aug 2, 6:12 pm, "Peter Jamieson"
wrote:
Depending on exactly what you need, you may not need a macro. Try...
a. in Excel, open the workbook, select the cell, then Edit|Copy
b. in Word, Edit|Paste Special and select "Paste Link". Then select one
of
the options such as Plain text.

A { LINK } field is inserted into the Word document. The result of the
LINK
field should be the value in the cell. If you modify the cell content,
then
update the LINK field (e.g. by selecting it and pressing F9) the field
result should be updated. You should be able to put such a field most
places
in a Word document (although there may be exceptions).

Peter wrote in message

oups.com...



Can anyone help me with a Macro, I have no experience in VBA at all.
I need a macro that will take a numerical value from a cell in excel
and put the vaule where ever I want it in word. Thanks for your help-
Hide quoted text -


- Show quoted text -


Thanks for your reply, but I dont want to do it that way because I
dont want the values to change everytime I change my excel work sheet.
I want a macro so when I run it, it takes the values from excel and
puts them into word



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing an Excel spreadsheet into Word Robert McN Microsoft Word Help 1 April 1st 07 03:33 PM
Importing entries from Excel into Word Tayo Microsoft Word Help 3 October 19th 06 09:13 PM
Importing information from contacts to word pbscott Microsoft Word Help 8 September 7th 06 10:25 PM
Importing reference/bibliography information Clement Chau Microsoft Word Help 1 August 1st 06 03:31 PM
Importing Excel into Word. sby Tables 1 November 24th 05 09:47 AM


All times are GMT +1. The time now is 01:36 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"