Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Switching Views in Word from Master to Normal from VB

Status
Not open for further replies.

mbr501

IS-IT--Management
Feb 19, 2001
21
0
0
US
I'm using automation - early binding in VB6 to automate a mail merge precedure in Word2K. There seems to be a bug when attempting to switch views in Word from VB from Master back to Normal using the code:

ActiveWindow.view.Type = wdNormalView

The issue is that I need to be in the Master View in order to manipulate my document, but I want to switch back to Normal View before I save them out as Word Files. This code seems to execute just fine in my program, however, the final documents continue to save in Master View Format.

Any ideas how to force the view back to Normal??

Thanks in advance!
 
Have you tried

If ActiveWindow.View.SplitSpecial = wdPaneNone Then
ActiveWindow.ActivePane.View.Type = wdNormalView
Else
ActiveWindow.View.Type = wdNormalView
End If

?
 
Thanks, but no cigar. Here's my code. Maybe I'm totally overlooking something: Please help:

'Must be in MasterView to work with
'Subdocs as separate files
Dim subdoc As Word.Subdocument

oApp.ActiveDocument.ActiveWindow.view = wdMasterView
For Each subdoc In oApp.ActiveDocument.Subdocuments

ReDim Preserve file_name(2, i&)
doc_id& = dac.GetKeys("document")

Set oDoc = subdoc.Open
'Remove NextPage section breaks
'originating from mailmerge

RemoveAllSectionBreaks oDoc

' The Next Line is Where I try to set it back to either
' NormalView (Note: I've tried every view and none seem to
' work). I've plugged your code in from your suggestion
' here but to no avail

oDoc.ActiveWindow.view = wdNormalView

file_name(1, i&) = ar(0) & doc_id& & ".doc"
oDoc.SaveAs FileName:=file_name(1, i&), _
FileFormat:=wdFormatDocument
oDoc.Close SaveChanges:=wdDoNotSaveChanges
 
Tried to do it manually. Still did not work.
Maybe Word always opens Master documents in Master view?
Sorry couldn't help.
 
Justin -

Thanks anyway! I appreciate your help. I'll let you know what I find out, but this is really puzzling.

-Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top