R
ryguy7272
I am running the following code in Excel:
Sub PushToWord()
Dim objWord As New Word.Application
Dim doc As Word.Document
Dim bkmk As Word.Bookmark
sWdFileName = Application.GetOpenFilename(, , , , False)
Set doc = objWord.Documents.Open(sWdFileName)
objWord.ActiveDocument.Variables("AllRuby").Value = Range("AllRuby").Value
objWord.ActiveDocument.Variables("AllianceRuby").Value =
Range("AllianceRuby").Value
objWord.ActiveDocument.Variables("EastRuby").Value = Range("EastRuby").Value
objWord.ActiveDocument.Variables("InsideSalesRuby").Value =
Range("InsideSalesRuby").Value
objWord.ActiveDocument.Variables("UnassignedRuby").Value =
Range("UnassignedRuby").Value
objWord.ActiveDocument.Variables("WestRuby").Value = Range("WestRuby").Value
objWord.ActiveDocument.Variables("TotalRuby").Value = Range("TotalRuby").Value
ActiveDocument.Fields.Update
objWord.Visible = True
End Sub
This is supposed to update DocVariables that I have already assigned in
Word. What it actually does is open a Word template, which I peppered with a
few DocVariables, but the template opens as 'Read Only'. When I try to
update the DocVariables, I receive a message that says 'Open a Read Only
Copy' and then 'Run-Time Error 4248: This Command is not available because no
document is open.' Any ideas as to what causes this? I've done this before
and never received this kind of error.
Thanks so much,
Ryan---
Sub PushToWord()
Dim objWord As New Word.Application
Dim doc As Word.Document
Dim bkmk As Word.Bookmark
sWdFileName = Application.GetOpenFilename(, , , , False)
Set doc = objWord.Documents.Open(sWdFileName)
objWord.ActiveDocument.Variables("AllRuby").Value = Range("AllRuby").Value
objWord.ActiveDocument.Variables("AllianceRuby").Value =
Range("AllianceRuby").Value
objWord.ActiveDocument.Variables("EastRuby").Value = Range("EastRuby").Value
objWord.ActiveDocument.Variables("InsideSalesRuby").Value =
Range("InsideSalesRuby").Value
objWord.ActiveDocument.Variables("UnassignedRuby").Value =
Range("UnassignedRuby").Value
objWord.ActiveDocument.Variables("WestRuby").Value = Range("WestRuby").Value
objWord.ActiveDocument.Variables("TotalRuby").Value = Range("TotalRuby").Value
ActiveDocument.Fields.Update
objWord.Visible = True
End Sub
This is supposed to update DocVariables that I have already assigned in
Word. What it actually does is open a Word template, which I peppered with a
few DocVariables, but the template opens as 'Read Only'. When I try to
update the DocVariables, I receive a message that says 'Open a Read Only
Copy' and then 'Run-Time Error 4248: This Command is not available because no
document is open.' Any ideas as to what causes this? I've done this before
and never received this kind of error.
Thanks so much,
Ryan---