mdnuts
Registered User.
- Local time
- Today, 04:59
- Joined
- May 28, 2014
- Messages
- 128
Hey folks.
I'm a bit tired this morning and excuse me for this but the question seems so familiar - I just can't think how to frame the question properly to search for it, and I'm pretty much out of time to work on this project.
I've got a sub that wouldn't compile due to it being 85kb vs 64kb. I don't have the time to go through it and see what I could reduce to get it under. So I'm trying to break it up into three sub's and I'm running into a continuity problem.
Proc1 and Proc2 take the word document and adds on tables as needed. The problem is proc1 or 2 doesn't recognize the oDoc/oWord/whatever was already opened in Sub Label194.
How do I get it to recognize that without creating a new document in each sub?
Thank you.
I'm a bit tired this morning and excuse me for this but the question seems so familiar - I just can't think how to frame the question properly to search for it, and I'm pretty much out of time to work on this project.
I've got a sub that wouldn't compile due to it being 85kb vs 64kb. I don't have the time to go through it and see what I could reduce to get it under. So I'm trying to break it up into three sub's and I'm running into a continuity problem.
Code:
Private Sub Label194_Click()
Dim oDoc As Word.Document
Dim oWord As Word.Application
Dim oTable As Word.table
Set oWord = CreateObject("Word.Application")
oWord.Visible = True
Set oDoc = oWord.Documents.Add
With oWord
.Activate
Call Proc1
Call Proc2
End With 'end with oword
With oWord.ActiveDocument.PageSetup
.TopMargin = oWord.InchesToPoints(0.88)
.LeftMargin = oWord.InchesToPoints(1)
.RightMargin = oWord.InchesToPoints(1)
.BottomMargin = oWord.InchesToPoints(1)
End With
oDoc.SaveAs2 "temp.doc"
Set oDoc = Nothing
Set oWord = Nothing
End Sub
How do I get it to recognize that without creating a new document in each sub?
Thank you.