Read rtf file in vba

User avatar
HansV
Administrator
Posts: 78951
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Read rtf file in vba

Post by HansV »

Yes - if you open the .rtf file in Word, you'll see that it contains multiple sections.

S2547.png
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

User avatar
DocAElstein
5StarLounger
Posts: 651
Joined: 18 Jan 2022, 15:59
Location: Re-routing rivers, in Hof, Beautiful Bavaria

Re: Read rtf file in vba

Post by DocAElstein »

OK, thanks.
If I click on that strange music symbol , I do see some "abschnitt" (Section) thing as you indicated, but in my Words so far, there is no Section info, bottom left, … by default … but I can get it – right click in the blue stripe bit at the bottom and check the option for it
right click, check Section option.JPG
Having a quick google says there is normally just one on a new document, so maybe that is why it was new to me. Sure enough I dug out a couple of my very longest word files and still only got… ( when looking at the html in a text editor of a document of a version saved as .htm ) ..just a single
<div class=WordSection1>
Maybe the 1 should have sparked my curiosity before.

Sounds like it’s not to do with some sort of forced on you thing, like a page. Something perhaps you might want to do perhaps to have different formatted sections. Probably ends up a more efficient and controlled way to do that instead of just selecting a whole chunk and applying format to it, perhaps.
( In the particular sample file, sample.rtf , it would appear that the page number corresponds to the same section number, coincidence or design, I have no idea )
I expect my limited use of word means I will likely never need it myself. I’ll quit quickly while I am ahead, before someone wants to inform me of some formatting style possibilities or such, Lol, and wait to, and hope to, have more time later to delve deeper into Word things. I’m still busy enough scratching the surface of Excel and Excel VBA

But I will know to watch out for more than one Section, when messing with documents I didn't create.
You do not have the required permissions to view the files attached to this post.
Last edited by DocAElstein on 03 May 2024, 06:32, edited 2 times in total.
I seriously don’t ever try to annoy. Maybe I am just the kid that missed being told about the King’s new magic suit, :(

User avatar
SpeakEasy
5StarLounger
Posts: 600
Joined: 27 Jun 2021, 10:46

Re: Read rtf file in vba

Post by SpeakEasy »

> I expect Input(LOF(1), 1) should be better Input(LOF(hFile), hFile) ? )

Yep. Mea culpa. Was trying to keep some of the OPs code, and forgot to update this bit. In this trivial example hFile happens to equal 1, so the code works - but it isn't best practice.

User avatar
SpeakEasy
5StarLounger
Posts: 600
Joined: 27 Jun 2021, 10:46

Re: Read rtf file in vba

Post by SpeakEasy »

>But it’s just a very tiny part of the original

It has the same full content as the UFT One document (well, there are some very minor differences). It ijust it lacks some of the (useful) navigation aids (which admittedly is a poor thing to do; I absolutely agree with you that Microsoft's handling of old documentation/articles is poor)

User avatar
DocAElstein
5StarLounger
Posts: 651
Joined: 18 Jan 2022, 15:59
Location: Re-routing rivers, in Hof, Beautiful Bavaria

Re: Read rtf file in vba

Post by DocAElstein »

. I am seeing it slightly differently now
, the redirect on the first link you gave
and the second link your gave
are both looking more similar.
I am fairly sure I went to just an introductory page when I first was redirected.
Something quirky is going on? – an intelligent redirect thing? Related to browser history or something else on a particular computer, IP address etc.
I have had this frustration before
Certainly I think you need to be careful with these links these days. I think perhaps we may possibly be seeing the start of where what and when you, or someone else, end up with can vary, and an organisation may be able to influence, for a price, what happens.

What is UFT One document?, wiki thinks UTF One started in 2019, and our original stuff seems to be from around the 2006 – 2008 time. If that is the case, then the UFT One document won’t necessarily be a good indication of the original content in this case


I still think, at first glance at least, I see more from the
(3rd party and original from wayback machine) ----- compared to the “newer” -------- (redirect or current)
I confess I have not read everything to see if its all there but just rearranged. That would take me a few weeks. It is not easy to make a quick comparison. But the "old" looks, on avarage, more
Pic is:-
--"Old" ------------------------------------------------------------------------------------------ "New"
old v new.JPG
old v new.JPG
You do not have the required permissions to view the files attached to this post.
I seriously don’t ever try to annoy. Maybe I am just the kid that missed being told about the King’s new magic suit, :(

User avatar
SpeakEasy
5StarLounger
Posts: 600
Joined: 27 Jun 2021, 10:46

Re: Read rtf file in vba

Post by SpeakEasy »

>UFT One

UFT One is the tool used by the 3rd party to display the document. The document is older than the tool., and is almost certainly extracted from an MSDN CD

User avatar
DocAElstein
5StarLounger
Posts: 651
Joined: 18 Jan 2022, 15:59
Location: Re-routing rivers, in Hof, Beautiful Bavaria

Re: Read rtf file in vba

Post by DocAElstein »

Ok, thanks, I thought maybe that, - It says UTF One top left on that 3rd party page.
Extraction from an older CD or DVD would be my choice, and more so as time goes on. I think it shouldn't be like that, so I do understand when people disagree with me, but sadly, I think that is the reality we may not always like to admit sometimes

One way or another, things ( me at the least , Lol ), are getting lost in the redirects....
I seriously don’t ever try to annoy. Maybe I am just the kid that missed being told about the King’s new magic suit, :(

User avatar
SpeakEasy
5StarLounger
Posts: 600
Joined: 27 Jun 2021, 10:46

Re: Read rtf file in vba

Post by SpeakEasy »

Here's how it looks on the October 2001 MSDN CDs (a whichj were represented by a set of windows help files, CHMs)
msdnchm.png
You do not have the required permissions to view the files attached to this post.

User avatar
DocAElstein
5StarLounger
Posts: 651
Joined: 18 Jan 2022, 15:59
Location: Re-routing rivers, in Hof, Beautiful Bavaria

Re: Read rtf file in vba

Post by DocAElstein »

I like the look of that - nice to see it.
I was still sleeping in my self imposed technology coma as a hermit when those chm hlp winhlp things where around.
I like the format.
( a while back I got the things to work on newer computers from help here , https://eileenslounge.com/viewtopic.php ... 61#p281561 )
( I even made one once, …… but it was right at the beginning of my awakening, in some frenzy, I think, https://www.excelforum.com/excel-new-us ... ost4827570 - God, what was I on, when I wrote postings like that, Lol. Still living exclusively off those vegetables, maybe. )
I seriously don’t ever try to annoy. Maybe I am just the kid that missed being told about the King’s new magic suit, :(

User avatar
SpeakEasy
5StarLounger
Posts: 600
Joined: 27 Jun 2021, 10:46

Re: Read rtf file in vba

Post by SpeakEasy »

As I am sure you are aware:

.hlp is an old type of help format based on a proprioetary mark up language created by Microsoft. They officially retired it upon the release of Vista (i.e no longer shipped support for it in the OS). After 'feedback' they grudgingly released winhlp32 for download for Vista, W7, W8 and W8.1 - but NO official version for W10 or W11. The W8/W8.1 version will work on W10 (and, I assume W11), but is a tricky to install correctly - me, I've never bothered)

.chm is the newer help file format, based off HTML, and was introduced in Windows 95, around about 10 years before .hlp was retired (so Microsoft gave plenty of warning that .hlp was going to disappear at some point). .chm remains fully supported across the WIndows OS family (and the MSDN CDs were chm)

User avatar
DocAElstein
5StarLounger
Posts: 651
Joined: 18 Jan 2022, 15:59
Location: Re-routing rivers, in Hof, Beautiful Bavaria

Re: Read rtf file in vba

Post by DocAElstein »

Thanks,
I can’t remember how far I got in the full understanding of these things back then, but I go through my older War and Peace postings, when I am feeling brave and fit enough to read through them, and then I try to check, correct and sanitise them. I have made a note to check back here when I do that one, to make sure I am saying things right , and add the insights you give.
Alan
I seriously don’t ever try to annoy. Maybe I am just the kid that missed being told about the King’s new magic suit, :(