E
Ekser
Hi,
Here's what i'd like to do:
I have a macro that gets data from the populated rabge in Excel an
transfers it into a Word document. This works fine with my test code
for one row.
What I'm trying to do, is that when this macro gets triggered i
'recognises' the selected row (1, 2, 3, 4, ...) and according to th
row number it populates my word document. Here's the code I hav
currently:
-Dim appWD As Word.Application
' Create a new instance of Word & make it visible
Set appWD = CreateObject("Word.Application.8")
appWD.Visible = True
Sheets("Template").Select
Range("A3").Copy
Sheets("Data").Select
Range("B3").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
Sheets("Template").Select
Range("C3").Copy
Sheets("Data").Select
Range("B4").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
etc.
' Copy the data for the new document to the clipboard
Range("A1:B14").Copy
' Tell Word to create a new document
appWD.Documents.Add
' Tell Word to paste the contents of the clipboard into the ne
document
appWD.Selection.Paste
Range("B3:B14").Select
Selection.ClearContents
Sheets("Template").Select-
So, I would like those A3, B3, C3 ... from my sheet template to b
recognized dynamically - when the user selects a whole range.
How to do this?
Thanks
Here's what i'd like to do:
I have a macro that gets data from the populated rabge in Excel an
transfers it into a Word document. This works fine with my test code
for one row.
What I'm trying to do, is that when this macro gets triggered i
'recognises' the selected row (1, 2, 3, 4, ...) and according to th
row number it populates my word document. Here's the code I hav
currently:
-Dim appWD As Word.Application
' Create a new instance of Word & make it visible
Set appWD = CreateObject("Word.Application.8")
appWD.Visible = True
Sheets("Template").Select
Range("A3").Copy
Sheets("Data").Select
Range("B3").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
Sheets("Template").Select
Range("C3").Copy
Sheets("Data").Select
Range("B4").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
etc.
' Copy the data for the new document to the clipboard
Range("A1:B14").Copy
' Tell Word to create a new document
appWD.Documents.Add
' Tell Word to paste the contents of the clipboard into the ne
document
appWD.Selection.Paste
Range("B3:B14").Select
Selection.ClearContents
Sheets("Template").Select-
So, I would like those A3, B3, C3 ... from my sheet template to b
recognized dynamically - when the user selects a whole range.
How to do this?
Thanks