Hi everyone,

I am very new to coding so I would greatly appreciate the help.

Below I have two different codes that i would like to combine or if possible run simultaneously.

One code is a find and replace that searches the entire word document for references and the other is
bookmark finder that copies specific cells in my spreadsheet and pastes it in the word document as an image.

any idea how this can be done?


Code 1:

Sub ReplaceWords()


Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Dim wdRng As Word.Range
Dim worddoc As Object


Set wdApp = CreateObject("word.application")
wdApp.Visible = True
Set wdDoc = wdApp.Documents.Open("C:\Users\Admin\Google Drive\SMS TEMPLATES\02 RISK ASSESSMENTS\001 Electrical works RA.docx")
For Each wdRng In wdDoc.StoryRanges


With wdRng.Find
.Text = "an1"
.Replacement.Text = Range("c8")
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll
.Text = "id1"
.Replacement.Text = Range("c5")
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll
.Text = "rd1"
.Replacement.Text = Range("c6")
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll


End With


Set wdApp = Nothing: Set wdDoc = Nothing: Set wdRng = Nothing


Next wdRng
End Sub

Code 2:


Sub CopyPasteImage()


Dim ws As Worksheet, msWord As Object, itm As Range
Dim savename As String
Dim fileext As String


Set ws = ActiveSheet
Set msWord = CreateObject("Word.Application")


With msWord
.Visible = True
.Documents.Open "C:\Users\Admin\Google Drive\SMS TEMPLATES\02 RISK ASSESSMENTS\001 Electrical works RA.docx"
.Activate

.ActiveWindow.View = xlNormalView
Range("K2:L15").Select
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
.ActiveDocument.Bookmarks("CompanyLogo").Select

.Selection.Paste
.Selection.TypeParagraph

.ActiveWindow.View = xlNormalView
Range("N2:O6").Select
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
.ActiveDocument.Bookmarks("ClientSig").Select

.Selection.Paste
.Selection.TypeParagraph

.ActiveDocument.SaveAs2 "C:\Users\Admin\Google Drive\SMS TEMPLATES\02 RISK ASSESSMENTS\001 Electrical works RA.docx"
.ActiveDocument.Close
.Quit


End With
End Sub