This one's a tuffy (I think). I've got a macro (from a previous post) that creates a word doc. and then allows me to copy/paste from excel to the newly-created word doc. I'm trying to modify this so that instead of the macro creating a new word doc. from scratch, the user will define an already-open word document in which the stuff from excel is to be pasted. I've gotten as far as settin the variable that represents the user-defined word doc. The problem I'm having is when I try to define that variable so that it can be used in the statements that paste into word. The code looks something like this:
Sub excel_to_word()
Dim FName As Variant
FName = Application.GetOpenFilename("Word Documents (*.doc), *.doc")
Dim wdDoc As Object
Set wdDoc = FName ****here is where the problem starts*****
Range("d9").Select
Selection.Copy
wdDoc.Paragraphs(wdDoc.Paragraphs.Count).Range.InsertParagraphAfter
wdDoc.Paragraphs(wdDoc.Paragraphs.Count).Range.Paste
end sub
Does anyone have any suggestions or similar code that I might be able to scratch a solution out of???
Sub excel_to_word()
Dim FName As Variant
FName = Application.GetOpenFilename("Word Documents (*.doc), *.doc")
Dim wdDoc As Object
Set wdDoc = FName ****here is where the problem starts*****
Range("d9").Select
Selection.Copy
wdDoc.Paragraphs(wdDoc.Paragraphs.Count).Range.InsertParagraphAfter
wdDoc.Paragraphs(wdDoc.Paragraphs.Count).Range.Paste
end sub
Does anyone have any suggestions or similar code that I might be able to scratch a solution out of???