I use this code in one document and it works fine:
Sub Subcontracter()
'
' Subcontracter Macro
'Dim strSubName As String
Dim i As Integer
strSubName = InputBox("Subcontractor")
With Selection
For i = 1 To 2
.GoTo What:=wdGoToBookmark, Name:="SubContr" & i
.TypeText Text:=strSubName
Next i
End With
End Sub
This is the macro I put in to the other file:
Sub Inserts()
'
' Inserts Macro
'Dim strProName As String
Dim i As Integer
strProjName = InputBox("Project Name")
With Selection
For i = 1 To 5
.GoTo What:=wdGoToBookmark, Name:="ProjName" & i
.TypeText Text:=strProjName
Next i
End With
End Sub
Every time it says Bookmark Does Not Exist, but it does. I'm not totally stupid, the name is exactly the same "ProjName" - I've checked a billion times. Any ideas?
Sub Subcontracter()
'
' Subcontracter Macro
'Dim strSubName As String
Dim i As Integer
strSubName = InputBox("Subcontractor")
With Selection
For i = 1 To 2
.GoTo What:=wdGoToBookmark, Name:="SubContr" & i
.TypeText Text:=strSubName
Next i
End With
End Sub
This is the macro I put in to the other file:
Sub Inserts()
'
' Inserts Macro
'Dim strProName As String
Dim i As Integer
strProjName = InputBox("Project Name")
With Selection
For i = 1 To 5
.GoTo What:=wdGoToBookmark, Name:="ProjName" & i
.TypeText Text:=strProjName
Next i
End With
End Sub
Every time it says Bookmark Does Not Exist, but it does. I'm not totally stupid, the name is exactly the same "ProjName" - I've checked a billion times. Any ideas?