I have a few Excel programs running in Excel 2010, but will not run in Office 365 Excel 16 due to reference library issues. Can I just change the highlighted code below? Heklprequired please
Code:
Sub ExportQuoteToWord725()
'Opens document template and fills out fields to create a quotation document for sales.
'Document template (QuoteP725.dotx) must be in the same folder as this spreadsheet.
'Rev 0 - Initial version
Dim aCell As Cell
Dim r As Long
Dim c As Long
Dim R1 As Integer
Dim myPath As String
myPath = ActiveWorkbook.Path 'Get location of current spreadsheet
If Dir(myPath & "\QuoteP725.dotx") = "" Then 'Quote template does not exist
MsgBox ("Put quote template (QuoteP725.dotx)" & vbCrLf & "into same folder as this spreadsheet")
Exit Sub
Else
[highlight #FCE94F]Dim wordApp As Word.Application
Dim wordDoc As Word.Document
[/highlight]
Application.ScreenUpdating = False 'Hide sheet selections from user
Sheets("Advanced cost calculator").Select 'Take all information from this sheet
On Error Resume Next
Set wordApp = GetObject(, "Word.Application") 'Check if Word is open already
If Err.Number <> 0 Then 'Word isn't already running
Set wordApp = CreateObject("Word.Application") 'Create new instance of an MS Word app
End If
On Error GoTo 0
wordApp.Visible = True 'Show newly-created MS Word object
Set wordDoc = wordApp.Documents.Add(myPath & "\QuoteP725.dotx") 'Open up quotation template file from current folder
'********************************************
'* *
'* This macro replaces contents of cells in *
'* a table in the word document *
'* *
'********************************************
'Populate first column with product code
wordDoc.Tables(4).Cell(2, 1).Range.Text = " " & Range("O19").Value & " Way Flush Mounting, Programmable Alarm Annunciator." 'Product code
wordDoc.Tables(4).Cell(5, 1).Range.Text = Range("O25").Value 'Window size
wordDoc.Tables(4).Cell(8, 1).Range.Text = Range("O13").Value & "W" & Range("O14").Value & "H" 'Panel Size
wordDoc.Tables(4).Cell(12, 1).Range.Text = Range("O26").Value 'Pushbutton
wordDoc.Tables(4).Cell(14, 1).Range.Text = Range("O19").Value & "A" 'Channel Count
wordDoc.Tables(4).Cell(15, 1).Range.Text = Range("P24").Value ' Unarmed
wordDoc.Tables(4).Cell(16, 1).Range.Text = Range("R25").Value 'Illumination