E
eholz1
Hello Group,
I am trying to pass a word doc object, a work app object, a string, and
a count
from my "main" program (in Excel vba) to set a style in my word doc.
I am formatting the word doc, from an excel spread sheet using vba from
the excel side.
here is the code (dStyle = "Header 3")
Sub SetStyle(wApp As Word.Application, dStyle As String)
With wApp.Selection
'.MoveDown Unit:=wdParagraph, Count:=nCount, Extend:=wdMove
.Style = ActiveDocument.Styles(dStyle)
End With
End Sub
If I put this code in-line where the (the main sub) doc and app objects
are defined, it works fine.
It works for the move if I have the .Style commented out. It seems i
cannot set the style from a sub proc. What am I doing wrong??
ewholz
I am trying to pass a word doc object, a work app object, a string, and
a count
from my "main" program (in Excel vba) to set a style in my word doc.
I am formatting the word doc, from an excel spread sheet using vba from
the excel side.
here is the code (dStyle = "Header 3")
Sub SetStyle(wApp As Word.Application, dStyle As String)
With wApp.Selection
'.MoveDown Unit:=wdParagraph, Count:=nCount, Extend:=wdMove
.Style = ActiveDocument.Styles(dStyle)
End With
End Sub
If I put this code in-line where the (the main sub) doc and app objects
are defined, it works fine.
It works for the move if I have the .Style commented out. It seems i
cannot set the style from a sub proc. What am I doing wrong??
ewholz