Hi all,

This is to request for your help in this MS Word issue. In the VB
application we are required to copy and paste temporary documents (containing
text, pictures, etc) into a single, final word document.



The main document contains tables and the issue is related w.r.to tables. In
the current application, the .rtf file is formed from the html file.



While copying, the blank pages get inserted in the document if the control
is in the â??last but oneâ?? row of a table and sometimes if the control is in
the last row during document generation process. This causes the extra page
in the document and page numbers are counted for this.



We are working on Windows 2000 Server as our OS.



In the existing code, section breaks (Next Page) are used. I am trying to
scan each and every page and finding if any empty page is there. If so, I
have planned to pass the delete key to delete the empty page.



Could you provide any pointers as how to go about this?



I need to scan each and every page of word doc and need to find if any blank
page is there. If so I need to delete the page programmatically.



Any help in this issue would be greatly appreciated.





Regards,

Kiruthiga.S

Re: Deletion of Empty Page in the Word Document through VBA by rVo

rVo
Tue Jan 17 10:42:17 CST 2006

I solved thi sin a similar project by doing a find and replace (record it as
macro)
and use
the comment signs are there to avoid our firewall from going bananas on this
post ;-)

' Selection.Find.ClearFormatting
' Selection.Find.Replacement.ClearFormatting
' With Selection.Find
' .Text = ChrW(12) & vbCr & ChrW(12)
' .Replacement.Text = ChrW(12)
' .Forward = True
' .Wrap = wdFindContinue
' End With
' Selection.Find.Execute Replace:=wdReplaceAll

chrw(12) is the code for a pagebreak

Hope this helps,

rVo

"Kiruthiga" <Kiruthiga@discussions.microsoft.com> schreef in bericht
news:9457D6E5-FF62-45DE-8A28-50BA2EA34EDE@microsoft.com...
> Hi all,
>
> This is to request for your help in this MS Word issue. In the VB
> application we are required to copy and paste temporary documents
(containing
> text, pictures, etc) into a single, final word document.
>
>
>
> The main document contains tables and the issue is related w.r.to tables.
In
> the current application, the .rtf file is formed from the html file.
>
>
>
> While copying, the blank pages get inserted in the document if the control
> is in the 'last but one' row of a table and sometimes if the control is in
> the last row during document generation process. This causes the extra
page
> in the document and page numbers are counted for this.
>
>
>
> We are working on Windows 2000 Server as our OS.
>
>
>
> In the existing code, section breaks (Next Page) are used. I am trying to
> scan each and every page and finding if any empty page is there. If so, I
> have planned to pass the delete key to delete the empty page.
>
>
>
> Could you provide any pointers as how to go about this?
>
>
>
> I need to scan each and every page of word doc and need to find if any
blank
> page is there. If so I need to delete the page programmatically.
>
>
>
> Any help in this issue would be greatly appreciated.
>
>
>
>
>
> Regards,
>
> Kiruthiga.S
>



Re: Deletion of Empty Page in the Word Document through VBA by Kiruthiga

Kiruthiga
Wed Jan 18 03:50:02 CST 2006

Hi rVo,

Thanks a lot.

I have used the below code to delete the empty page. Could you please tell
me whether this is feasible. It deleted the blank page but i am not sure
whether it will work out for all cases. It will be great if you provide me
some tips on it.

wrdselection.Find.ClearFormatting
wrdselection.Find.Replacement.ClearFormatting
With wrdselection.Find
.Text = "^b"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue

End With
wrdselection.Find.Execute Replace:=wdReplaceAll


Also i am trying to scan each and every page and finding if it ia blank
page. if so i am deleting it using range property.

Regards
Kiruthiga
"rVo" wrote:

> I solved thi sin a similar project by doing a find and replace (record it as
> macro)
> and use
> the comment signs are there to avoid our firewall from going bananas on this
> post ;-)
>
> ' Selection.Find.ClearFormatting
> ' Selection.Find.Replacement.ClearFormatting
> ' With Selection.Find
> ' .Text = ChrW(12) & vbCr & ChrW(12)
> ' .Replacement.Text = ChrW(12)
> ' .Forward = True
> ' .Wrap = wdFindContinue
> ' End With
> ' Selection.Find.Execute Replace:=wdReplaceAll
>
> chrw(12) is the code for a pagebreak
>
> Hope this helps,
>
> rVo
>
> "Kiruthiga" <Kiruthiga@discussions.microsoft.com> schreef in bericht
> news:9457D6E5-FF62-45DE-8A28-50BA2EA34EDE@microsoft.com...
> > Hi all,
> >
> > This is to request for your help in this MS Word issue. In the VB
> > application we are required to copy and paste temporary documents
> (containing
> > text, pictures, etc) into a single, final word document.
> >
> >
> >
> > The main document contains tables and the issue is related w.r.to tables.
> In
> > the current application, the .rtf file is formed from the html file.
> >
> >
> >
> > While copying, the blank pages get inserted in the document if the control
> > is in the 'last but one' row of a table and sometimes if the control is in
> > the last row during document generation process. This causes the extra
> page
> > in the document and page numbers are counted for this.
> >
> >
> >
> > We are working on Windows 2000 Server as our OS.
> >
> >
> >
> > In the existing code, section breaks (Next Page) are used. I am trying to
> > scan each and every page and finding if any empty page is there. If so, I
> > have planned to pass the delete key to delete the empty page.
> >
> >
> >
> > Could you provide any pointers as how to go about this?
> >
> >
> >
> > I need to scan each and every page of word doc and need to find if any
> blank
> > page is there. If so I need to delete the page programmatically.
> >
> >
> >
> > Any help in this issue would be greatly appreciated.
> >
> >
> >
> >
> >
> > Regards,
> >
> > Kiruthiga.S
> >
>
>
>

Re: Deletion of Empty Page in the Word Document through VBA by Kiruthiga

Kiruthiga
Wed Jan 18 05:52:02 CST 2006

Hi rVo,

The find string "^b" is not working. Also the string that you have given
also doesn't work.

The document which i am using has section breaks and page breaks.

Could you please help me to resolve the issue.


Regards
Kiruthiga


"Kiruthiga" wrote:

> Hi rVo,
>
> Thanks a lot.
>
> I have used the below code to delete the empty page. Could you please tell
> me whether this is feasible. It deleted the blank page but i am not sure
> whether it will work out for all cases. It will be great if you provide me
> some tips on it.
>
> wrdselection.Find.ClearFormatting
> wrdselection.Find.Replacement.ClearFormatting
> With wrdselection.Find
> .Text = "^b"
> .Replacement.Text = ""
> .Forward = True
> .Wrap = wdFindContinue
>
> End With
> wrdselection.Find.Execute Replace:=wdReplaceAll
>
>
> Also i am trying to scan each and every page and finding if it ia blank
> page. if so i am deleting it using range property.
>
> Regards
> Kiruthiga
> "rVo" wrote:
>
> > I solved thi sin a similar project by doing a find and replace (record it as
> > macro)
> > and use
> > the comment signs are there to avoid our firewall from going bananas on this
> > post ;-)
> >
> > ' Selection.Find.ClearFormatting
> > ' Selection.Find.Replacement.ClearFormatting
> > ' With Selection.Find
> > ' .Text = ChrW(12) & vbCr & ChrW(12)
> > ' .Replacement.Text = ChrW(12)
> > ' .Forward = True
> > ' .Wrap = wdFindContinue
> > ' End With
> > ' Selection.Find.Execute Replace:=wdReplaceAll
> >
> > chrw(12) is the code for a pagebreak
> >
> > Hope this helps,
> >
> > rVo
> >
> > "Kiruthiga" <Kiruthiga@discussions.microsoft.com> schreef in bericht
> > news:9457D6E5-FF62-45DE-8A28-50BA2EA34EDE@microsoft.com...
> > > Hi all,
> > >
> > > This is to request for your help in this MS Word issue. In the VB
> > > application we are required to copy and paste temporary documents
> > (containing
> > > text, pictures, etc) into a single, final word document.
> > >
> > >
> > >
> > > The main document contains tables and the issue is related w.r.to tables.
> > In
> > > the current application, the .rtf file is formed from the html file.
> > >
> > >
> > >
> > > While copying, the blank pages get inserted in the document if the control
> > > is in the 'last but one' row of a table and sometimes if the control is in
> > > the last row during document generation process. This causes the extra
> > page
> > > in the document and page numbers are counted for this.
> > >
> > >
> > >
> > > We are working on Windows 2000 Server as our OS.
> > >
> > >
> > >
> > > In the existing code, section breaks (Next Page) are used. I am trying to
> > > scan each and every page and finding if any empty page is there. If so, I
> > > have planned to pass the delete key to delete the empty page.
> > >
> > >
> > >
> > > Could you provide any pointers as how to go about this?
> > >
> > >
> > >
> > > I need to scan each and every page of word doc and need to find if any
> > blank
> > > page is there. If so I need to delete the page programmatically.
> > >
> > >
> > >
> > > Any help in this issue would be greatly appreciated.
> > >
> > >
> > >
> > >
> > >
> > > Regards,
> > >
> > > Kiruthiga.S
> > >
> >
> >
> >