Excel to Word

wtnelso

Board Regular
Joined
Feb 15, 2012
Messages
241
I currently have a code that exports the selected items to Word, but I want to modify the code so that it will give a message box that will ask if I want to use the currently opened sheet, or open a new one? How could I modify this code to do so? What could be put into the Cases below to accomplish that? Thank you!
Code:
Sub Excel_to_Word()
    Dim appWord As Word.Application
     
    Set appWord = New Word.Application
     
    If appWord.Visible = False Then
        appWord.Visible = True
    ElseIf appWord.Visible = True Then
        Response = MsgBox("New Sheet?", vbQuestion + vbYesNo)
        Select Case Response
        Case Is = vbYes
    
        Case Is = vbNo
        
        End Select
    End If
    Selection.Copy
     
    appWord.Documents.Add.Content.Paste
     
End Sub
     
End Sub
 
Thanks Ed! I really appreciate it. As I look through the code, which portion copies and pastes, or do I need to insert that?
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
There is nothing in there that copies and pastes.
You will have to determine:
-- how to identify the book, sheet, and range you want to copy
-- where and how to position the insertion point in your document
-- how you want the information to get pasted into Word
 
Upvote 0

Forum statistics

Threads
1,216,172
Messages
6,129,291
Members
449,498
Latest member
Lee_ray

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top