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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pagination Problem Word Macro vba

Status
Not open for further replies.

autumnEND

Programmer
Nov 1, 2005
61
GB
I created a vba macro that opens a range of documents from a folder , and it checks for specific date in each document and if its incorrect changes the date and saves the new document with the new date . etc

it works fine, other than when i open the new outputted document , the pagination isnt there.

the files are in the format, Microsoft Write.

is there a way to make the outputted document paginated the same way as the initial document.

ive tried:
Options.Pagination = True

but that didnt work.

any help would be greatly appreciated.
 
it works fine, other than when i open the new outputted document , the pagination isnt there.
Please explain that. The pagination "isnt there"? Huh? You mean there are no pages? Do you mean the page breaks are not what you are expecting? Do you mean...I don't know what you mean.

Also, as this is apparently just changing a date, why would there BE any changes to pages? Are you saving the new files as Word .doc? If the originals are Write files, then yes it quite possible the pagination could be different.

Please clarify.

Gerry
 
sorry, i wasnt very clear .
i am saving the new files as .wri , windows write.

when i open the outputted file it appears as one big document and isnt split up by page breaks.

it searches for "release date Jan 06" and replaces with "Release date May 06" , so it replaces an actual phrase in the document

it also removes subscripts and then saves the new outputted file the origional doc isnt changed

hope this makes things more clear.
 
when i open the outputted file it appears as one big document and isnt split up by page breaks.
Really? More questions.

1. How are you opening these files?
2. How, precisely, are you saving them?

Post some code.

Gerry
 
I open them using Windows Write.
and am saving them using the code below based.

If blnFoundCorrReleaseDate Then
If blnFoundSubscript Or blnFoundUnderlining Then
If m_blnReplaceFormatting Then
If Not (blnFoundOneYet) Then
CreateFolderForResults strResultsFolder
End If

oDoc.SaveAs FileName:=m_strPathToFiles & strResultsFolder & "\" & strfile
End If

End If

it basically makes a folder and thens saves the files to it .
 
I open them using Windows Write.
Hmmm, that is not in your posted code. Your code looks like it is in Word. So, again, how are you opening them? You are not saving them as .wri files. You are saving them as .DOC file - or so it seems. Maybe I'm wrong. It is hard to tell as you did not post enough code to really tell. The SaveAs instruction line sure looks like a Word .doc save to me.;

Gerry
 
I open them using Windows Write
How do you do this ?
For me, write is a windows 3.x app replaced by wordpad ...
Are you still with WFW 3.11 ???

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
yeah its a really old program , not sure why they still use it at work :s

i run the macro in word.

i use windows xp , but have got a conversion pack from windows which has comes with a write converter / which enables me to save as write files and open write files in write etc.

with the macro , as they are opened as .wri format . they are outputted as .wri files.

ill have to post some more code when im back at work :( as i dont have access to it at home
 
open write files in write etc.
I woul ddispute this. I do not think you are opening the files in Write. I do no think that write.exe is executed. I think you are opening the files in Word.

Gerry
 
Hi autumnEND,

Try changing your oDoc.SaveAs line to:
Code:
oDoc.SaveAs FileName:=m_strPathToFiles & strResultsFolder & "\" & strfile, FileFormat:=105
just to ensure the file isn't being changed to some other format along the way.

Also, if you're trying to open this file by double-clicking on it in XP, it's most likely opening in WordPad, which doesn't display nay of the formatting, let alone page breaks.

If you've got the converters installed for Word (as you say you have), then opening the file from within Word should show all formatting, including page breaks.

Cheers

[MS MVP - Word]
 
I am assuming that the file is being opened by code - not double clicking. This IS a code issue, is it not?

Gerry
 
Hey macropod, ill give that a try when i get to work tomorrow.

oDoc.SaveAs FileName:=m_strPathToFiles & strResultsFolder & "\" & strfile, FileFormat:=105

is FileFormat:=105 , windows write format?

the string i use "strfile" is the origional doc name including the extension eg doc1.wri.

so ill have to trim the extension of the end and then try the FileFormat:=105 code.

hi fumei, i am double clicking them to open them , but only after i have run the macro , but it is a code problem .

thanks for the help so far .
 
I am very confused now. The files are opened by double clicking them. OK. So...how are you getting them to interact with the VBA code? Please explain this to me, as I am totally lost as to what you are doing.+ There is obviously much more in your code than you are showing here.

Gerry
 
Hi autumnEND,

It shouldn't be necessary to delete the file's extension, and yes, FileFormat:=105 is the Write format.

As I said before, double-clicking the file on any recent Windows versions is probably going to open it in WordPad, which won't show any formatting. If that's what happening and you change the file association so that Write files open in Word, everything should be OK.

Cheers

[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top