View Single Post
 
Old 09-12-2022, 08:14 PM
getsubodh@gmail.com getsubodh@gmail.com is offline Windows 11 Office 2019
Novice
 
Join Date: Sep 2022
Posts: 1
getsubodh@gmail.com is on a distinguished road
Default Open word document and copy

Hi I am using the following code to open a word document
Sub Open_Word_Doc()
Dim intChoice As Integer
Dim strPath As String
Dim objWord As Object
Set objWord = CreateObject("Word.Application")
objWord.Visible = True

Application.FileDialog(msoFileDialogOpen).AllowMul tiSelect = False
intChoice = Application.FileDialog(msoFileDialogOpen).Show
'if the user selects a file
If intChoice <> 0 Then
'get the path selected
strPath = Application.FileDialog( _
msoFileDialogOpen).SelectedItems(1)
'opens the document
objWord.Documents.Open (strPath)

End If
End Sub

I am trying to amend it so that i can copy all the contents of the word document (like Ctrl + A ) and copy it.

How can i do that.

Thanks in advance.
Reply With Quote