csekhar.apps
New Member
- Joined
- Apr 19, 2010
- Messages
- 5
Hi All,
Thanks in advance,I'm a complete newbie when it comes to VBA programming, Excel and Word other than the most basic of use.
I have a word document which I would like to automatically populate data from Excel into. The word document is a template and I would rather the data from excel didn't just appear in a line but rather in the various places on the page and different pages it should go.
For instance
------A---------B---------------C--------D-----------E----------F
first page
1----Fred------01-Jan-2010------San Jose,CA-----Left-----------£55.55-----YES
second page
2----John------01-Jan-2010------San Jose,CA-----Available------£99.99-----YES
To appear as
Account Name - Fred (A1)
Due Date - 01-Jan-2010 (B1)
Address- San Jose,CA (C1)
Status - Left (D1)
I would like to extract the data from A1, B1 and D1 into word document in page1.
Then other values extract from A2, B2 and D2 into another page2.
Ideally I would like to add a button by the clicking of this button the word document is created. The button should self populate values
in Word document in different places on different pages.Hope I am not confusing in my requirement
If I'm asking too much then please tell me, if the facility to do this is too difficult equally let me know.
I've viewed the code that others have posted which simply copy the data from excel to word this doesn't really suit my requirements.in fact this is my code and where i stuck
Sub PasteToWord()
Dim AppWord As Word.Application
Set AppWord = CreateObject("Word.Application")
AppWord.Visible = True
' Change the range to suit your needs. See the How to Use for this code
Sheets("Sheet1").Range("A1:C10").Copy
AppWord.Documents.Add
AppWord.Selection.Paste
Application.CutCopyMode = False
Set AppWord = Nothing
End Sub
Sub CellsExample()
For i = 1 To 25
For j = 1 To 10
Cells(i, j) = "Rows " & i & " Cols " & j
Next j
Next i
End Sub
Thanks once again
Thanks in advance,I'm a complete newbie when it comes to VBA programming, Excel and Word other than the most basic of use.
I have a word document which I would like to automatically populate data from Excel into. The word document is a template and I would rather the data from excel didn't just appear in a line but rather in the various places on the page and different pages it should go.
For instance
------A---------B---------------C--------D-----------E----------F
first page
1----Fred------01-Jan-2010------San Jose,CA-----Left-----------£55.55-----YES
second page
2----John------01-Jan-2010------San Jose,CA-----Available------£99.99-----YES
To appear as
Account Name - Fred (A1)
Due Date - 01-Jan-2010 (B1)
Address- San Jose,CA (C1)
Status - Left (D1)
I would like to extract the data from A1, B1 and D1 into word document in page1.
Then other values extract from A2, B2 and D2 into another page2.
Ideally I would like to add a button by the clicking of this button the word document is created. The button should self populate values
in Word document in different places on different pages.Hope I am not confusing in my requirement
If I'm asking too much then please tell me, if the facility to do this is too difficult equally let me know.
I've viewed the code that others have posted which simply copy the data from excel to word this doesn't really suit my requirements.in fact this is my code and where i stuck
Sub PasteToWord()
Dim AppWord As Word.Application
Set AppWord = CreateObject("Word.Application")
AppWord.Visible = True
' Change the range to suit your needs. See the How to Use for this code
Sheets("Sheet1").Range("A1:C10").Copy
AppWord.Documents.Add
AppWord.Selection.Paste
Application.CutCopyMode = False
Set AppWord = Nothing
End Sub
Sub CellsExample()
For i = 1 To 25
For j = 1 To 10
Cells(i, j) = "Rows " & i & " Cols " & j
Next j
Next i
End Sub
Thanks once again