Hello,
I have a macro on my computer that works perfectly but it does not work on 2 others computers, but not the same lines...
I tested on a colleague (1) computer (Excel for office 365 MSO - 32 bits)
Some line at the very end of the macro has an error
With the macro I am creating a word document and skipping some line in word so this code line works on mine but not my colleage(1):
Error is on the last line showing :
Run-time error '91': Object variable or With block cariable not set
Documents.Application.Selection.MoveDown Unit:=wdLine, Count:=2 (This line has an error on my colleague(1) computer but works on mine)
Then me second colleague(2) has a different error at the very beginning of the macro but this line works on my first colleague(1) computer and on mine
Error is on the Selection. line, error code is: Invalid Procedure call or argument '5'
Why is it working on some computer then others don't and not always the same line
Since I created the macro for about 10 colleagues that will use them, if everyone has different errors it will be hell for me to fix them ahah
Thank you for your help in advance!
I have a macro on my computer that works perfectly but it does not work on 2 others computers, but not the same lines...
I tested on a colleague (1) computer (Excel for office 365 MSO - 32 bits)
Some line at the very end of the macro has an error
With the macro I am creating a word document and skipping some line in word so this code line works on mine but not my colleage(1):
Error is on the last line showing :
Run-time error '91': Object variable or With block cariable not set
VBA Code:
Sub CreateWord()
Dim wordHeader As Variant
Set wordHeader = Sheets("...").Range("A7")
Dim wordName As Variant
Set wordName = Sheets("...").Range("A4")
Sheets("...").Activate
Dim PT As PivotTable
Set PT = ActiveSheet.PivotTables(1)
PT.TableRange1.Select
Selection.Copy
Dim myDoc As Word.Document
Dim wordapp
Dim strFile As String
strFile = "C:\Users\" & Environ$("username") & "\...\....docm"
Set wordapp = CreateObject("word.Application")
wordapp.Documents.Open strFile
wordapp.Visible = True
wordapp.Activate
Documents.Application.Selection.MoveDown Unit:=wdLine, Count:=2 (This line has an error on my colleague(1) computer but works on mine)
Then me second colleague(2) has a different error at the very beginning of the macro but this line works on my first colleague(1) computer and on mine
Error is on the Selection. line, error code is: Invalid Procedure call or argument '5'
VBA Code:
Columns("A:F").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF($AA1>0,1,0)"
Why is it working on some computer then others don't and not always the same line
Since I created the macro for about 10 colleagues that will use them, if everyone has different errors it will be hell for me to fix them ahah
Thank you for your help in advance!