Link to home
Start Free TrialLog in
Avatar of QualitySoftwareDevelopment
QualitySoftwareDevelopment

asked on

vbCrLf vs. Office 2007

Hi,
I have made a worddocumentgenerator in VB through Access. It works great in word 2003, but since word 2007 it has change the events.

I have tried to to replace the vbCrLf with both Chr(10) and Chr (13) but without any luck

Any ideas?
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

QualitySoftwareDevelopment said:
>>Any ideas?

Not sure what the trouble is, but vbCrLf is equivalent to Chr(13) & Chr(10), in that order.

Perhaps if you posted the code the situation would become clearer...
Avatar of QualitySoftwareDevelopment
QualitySoftwareDevelopment

ASKER

The code is
InsertAfter "FIRMNAME" & vbCrLf & "Rapport no." & " " & rsRapport("Rapportnr")

I then tried to replace the vbCrLf with Chr(13) which didn't work and then after that I replaced it with Chr(10) which didn't help either.

The problem:
In word 2003 the output is:
----
FIRMNAME The Firm
Rapport no. 10002
----

In Word 2007 the output is:
----
FIRMNAME The Firm

Rapport no. 10002
----

and I need it to be as in 2003

The case is that in word 2003 you get the lineshiftas above with a RETURN, but to get the same lineshift in word 2007 you have to use SHIFT-RETURN
QualitySoftwareDevelopment said:
>>I then tried to replace the vbCrLf with Chr(13) which didn't work and then after that I replaced it with Chr(10) which didn't help either.

As I stated in my first comment, vbCrLf is equivalent to Chr(13) & Chr(10)...

InsertAfter "FIRMNAME" & Chr(13) & Chr(10) & "Rapport no." & " " & rsRapport("Rapportnr")

If that does not solve the problem, I suggest that you use the "request attention" link, and ask the Moderators
to add the Microsoft Word zone to this question.  I dabble in VBA for Word, but there are many *real* Experts
in that zone.
The reason your output shows spacing is more than likely due to the Normal style having a spacing of 1.15" in Office 2007. You might have also noticed that the standard font is Calibri rather than TNR. Once you modify the Normal style, your results will be as expected.

Dawn Bleuel
Word MVP
ASKER CERTIFIED SOLUTION
Avatar of dlc110161
dlc110161
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thx to all I'm back at the office on Thueday where I'll test your results
... and it actually also works with vbCrLf, thx!