Sample Programs

User avatar
BobH
UraniumLounger
Posts: 9188
Joined: 13 Feb 2010, 01:27
Location: Deep in the Heart of Texas

Sample Programs

Post by BobH »

In my quest to learn more about VBA for Word, I bought the O'Reilly book, Writing Word Macros, by Steven Roman. In it he mentions that all the sample programs in the book are available online; however, the book was published a couple of decades ago ('99), and the sample programs apparently are no longer available. At any rate, the urls given and found by searching the 'Net do not turn them up.

Does anyone, by chance, know where I can find these sample programs, or have a copy they are willing to share?

:cheers: :chocciebar: :thankyou:
Bob's yer Uncle
(1/2)(1+√5)
Intel Core i5, 3570K, 3.40 GHz, 16 GB RAM, ECS Z77 H2-A3 Mobo, Windows 10 >HPE 64-bit, MS Office 2016

User avatar
Doc.AElstein
BronzeLounger
Posts: 1499
Joined: 28 Feb 2015, 13:11
Location: Hof, Bayern, Germany

Re: Sample Programs Method a)

Post by Doc.AElstein »

Hi Bob
I don’t have that book, but I have the very similar one, the O'Reilly book, Writing Excel Macros, by Steven Roman.

I was able to get the macros for that in the following way. You might be able to do something similar to get the macros you want.

In my book it tells me to get the sample programs from here http://www.oreilly.com/catalog/exlmacro2

But if I try that link it does not get me anywhere, or rather it gets me redirected to a modern site with no hint of any information about the old books

However, if I put that link in the search bar of web.archive.org , https://i.postimg.cc/ZYDh9DCy/link-in-w ... ve-org.jpg , then I get a lot of offered captures.
https://i.postimg.cc/bN7cgD0y/Lots-of-c ... e-from.jpg

I randomly then try out the offered captures.

Eventually I find in one of them a link that looks promising, https://i.postimg.cc/4xpCSfwz/Found-a-l ... ograms.jpg
https://i.postimg.cc/02M17dwX/This-got- ... p-file.jpg
That link got me a download of a zip file with all the macros in it.
https://i.postimg.cc/qqYf9g9G/Got-um.jpg



If you have no luck, pass me the link from the book, and I will try to see if I strike lucky. It seems to be a bit hit and miss with getting things from the web archive


Alan
Last edited by Doc.AElstein on 06 Dec 2021, 11:25, edited 1 time in total.
I am having difficulty logging in with this account just now.
You can find me at DocAElstein also

User avatar
BobH
UraniumLounger
Posts: 9188
Joined: 13 Feb 2010, 01:27
Location: Deep in the Heart of Texas

Re: Sample Programs

Post by BobH »

Thanks, Doc!!!
Bob's yer Uncle
(1/2)(1+√5)
Intel Core i5, 3570K, 3.40 GHz, 16 GB RAM, ECS Z77 H2-A3 Mobo, Windows 10 >HPE 64-bit, MS Office 2016

User avatar
Doc.AElstein
BronzeLounger
Posts: 1499
Joined: 28 Feb 2015, 13:11
Location: Hof, Bayern, Germany

Re: Sample Programs Method b)

Post by Doc.AElstein »

Hi Bob
I tried in the usual way as I described, a few times.
It almost gets there, but unfortunately always seems so far to cr'p out at the last stage :(

_.__________________________________

So then,
I tried method b) – overdose on caffeine and then randomly frantically looking around the net. Once in a while this seems to work when all else fails.

I have some stuff and they seem to have some macros for that book, … somewhere
Examples.zip - https://app.box.com/s/w75bf0yb8dv875u0myyyg6xxmr9csiw3
RomanWortdBook.dot - https://app.box.com/s/t09e5w0hrr71slos3tlnb5ds9byw5s3p
BobsdBook.doc - https://app.box.com/s/2wwnfuxupruw8jzfmlhlown9trv8yx3t

They may not be in all those things: I don’t have much experience in Word VBA and I am a bit confused about how and where you find the macros in them. I think they are somewhere to find in one of those things. I can see them in the VB Editor, but I am not clear how you tie up stuff in the Word VB Editor with open Word docs
https://i.postimg.cc/0yzJhh19/Bobs-Book ... Macros.jpg



If you can find there what you want , I will try to work backwards and figure out how I found the stuff, for future reference. The disadvantage of method b) is that it only woks for me when I do it very quickly working from instinct in a mad frenzy
Unfortunately method b) has never worked when I try to do it more logically and methodically taking notes as I go along.


Alan
You do not have the required permissions to view the files attached to this post.
I am having difficulty logging in with this account just now.
You can find me at DocAElstein also

User avatar
BobH
UraniumLounger
Posts: 9188
Joined: 13 Feb 2010, 01:27
Location: Deep in the Heart of Texas

Re: Sample Programs

Post by BobH »

Thank you, Doc!!!!

I found a web page for Dr. Roman and used it's contact data to reach out to him. He told me that O'Reilly has apparently abandoned the sample programs. I was surprised and pleased by how promptly and cordially he responded.

I'll give your information a shot.

Not sure I understood your statement, ". . . but I am not clear how you tie up stuff in the Word VB Editor with open Word docs." If I interpret it correctly you are saying that you don't know how to access macros (VBA) in Word. What I've learned (so far and so little) is that you access the Developer tab on the ribbon as shown in the screenshot.
Word VBA and Macros.PNG
Thanks again for your generous help!!!
:cheers: :chocciebar: :thankyou:
You do not have the required permissions to view the files attached to this post.
Bob's yer Uncle
(1/2)(1+√5)
Intel Core i5, 3570K, 3.40 GHz, 16 GB RAM, ECS Z77 H2-A3 Mobo, Windows 10 >HPE 64-bit, MS Office 2016

User avatar
BobH
UraniumLounger
Posts: 9188
Joined: 13 Feb 2010, 01:27
Location: Deep in the Heart of Texas

Re: Sample Programs

Post by BobH »

Doc! Thank you!

I was able to find the samples in the RomanWordBook file!

:cheers: :chocciebar: :cheers:

:wine: :wine: :wine: :wine:
Bob's yer Uncle
(1/2)(1+√5)
Intel Core i5, 3570K, 3.40 GHz, 16 GB RAM, ECS Z77 H2-A3 Mobo, Windows 10 >HPE 64-bit, MS Office 2016

User avatar
Doc.AElstein
BronzeLounger
Posts: 1499
Joined: 28 Feb 2015, 13:11
Location: Hof, Bayern, Germany

Re: Sample Programs

Post by Doc.AElstein »

Hi Bob
BobH wrote:
06 Dec 2021, 19:12
.... but I am not clear how you tie up stuff in the Word VB Editor with open Word docs." If I interpret it correctly you are saying that you don't know how to access macros (VBA) in Word. What I've learned (so far and so little) is that you access the Developer tab on the ribbon as shown in the screenshot.....
That looks familiar, a bit similar to Excel VBA which I know about. - I only have a few Word macros, most of my word work is very simple word processing. All my Word macros seem to be on one machine , I think in a “Normal” thing which always appears in the VB Editor with all the coding when I hit Alt+F11

It’s the sharing of Word VBA things that I am not too sure about. I have rarely done that.

I was just about to post as you did your last post and say that my best guess is that what you want is somehow in that RomanWordBook file. The BobsBook.doc is probably a Red Herring: It just appeared ( named something simple like document1 ) suddenly while I was trying to figure out what to do with the other files, so I saved it to be on the safe side. But I expect you can ignore that. I think it’s probably empty.

I expect the book will tell you exactly what you should do with the RomanWordBook.dot – I never renamed that file – its just as I found it. I am not quite sure what the .dot means.

Things are slightly differently organised I think with VBA in Word and Excel.
If you have any problems doing anything with that .dot file then probably that chap Chris can help, - its not unknown for him to be dabbling with old Word files, weather permitting, :) :snow:

Alan
I am having difficulty logging in with this account just now.
You can find me at DocAElstein also

User avatar
BobH
UraniumLounger
Posts: 9188
Joined: 13 Feb 2010, 01:27
Location: Deep in the Heart of Texas

Re: Sample Programs

Post by BobH »

Thank you, again, Doc!!

I have already saved the sample programs. The .dot extension is a mystery to me as well but it gave me no trouble. I think it might be an old extension for either Word or WordPerfect, but memory ain't what it used to be at 80. The contents are all the VBA editor when I opened the file in Word, which warned me about opening files that contain macros.

OK an hour or so has passed and I've had time to look up the .dot extension. It was used in an earlier version of Word for template files. I think that might go all the way back to Word in DOS and very early Windows versions.

It must have still been in use in 1999 which is when Dr. Roman's book was published. I have no idea when it might of changed but OFIB (Our Friend in Bonavista) will surely know. :grin:
Bob's yer Uncle
(1/2)(1+√5)
Intel Core i5, 3570K, 3.40 GHz, 16 GB RAM, ECS Z77 H2-A3 Mobo, Windows 10 >HPE 64-bit, MS Office 2016

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

Re: Sample Programs

Post by HansV »

In versions of Word up to and including Word 2003, documents had extension .doc and templates had extension .dot.
In Word 2007 and later, documents without VBA code have extension .docx and documents with VBA code have extension .docm.
Templates without VBA code have extension .dotx and templates with VBA code have extension .dotm.
Of course, these newer versions can still open, edit and save both .doc and .dot files too.
Best wishes,
Hans

User avatar
Doc.AElstein
BronzeLounger
Posts: 1499
Joined: 28 Feb 2015, 13:11
Location: Hof, Bayern, Germany

Re: Sample Programs

Post by Doc.AElstein »

Thx both, - sounds like it’s similar to Excel then. Around 2007 with the Ribbon introduction they went from 3 to 4 characters in the extension adding the extra x or m to distinguish files with and without macros with m being the files with macros in.
The t was throwing me off, - I’ve never had anything to do with a template file in Word or Excel, - its part of the other 99.99% of the vast area of Excel that I don’t know about

I have only ever used .xls .xlsx .xlsm .doc .docx , maybe once or twice I had a .docm file
Any word macro I ever had ( recorded ) found its own way into a “Normal” thing in the VB editor and they always work on any word file I have open. Any other Word macros I got from anywhere I then just put in there as well, and they worked then also on any word file I had open, so I never bothered to get any better informed with Word VBA as I rarely do much of any significance in Word
I am having difficulty logging in with this account just now.
You can find me at DocAElstein also

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15448
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Sample Programs

Post by ChrisGreaves »

BobH wrote:
07 Dec 2021, 00:33
I have no idea when it might of changed but OFIB (Our Friend in Bonavista) will surely know. :grin:
YEIB(ref "SW vs. Texas") remembers persuading the training centre to include a "delete Normal.dot" instruction in all their courses in Word 2.0, let alone Word 6.0.

Speaking of which, I have a suggestion:-
You say that you have recorded several macros and shoveled them into Normal.dot, so Normal.dot sounds like your lifetime accumulation of "VBA STUFF".
Why not chop down a small softwood tree and print out all the VBA code from your Normal.dot and keep it deskside as a reference?

As you read up any feature of VBA, look through your printout and find where that feature appears in your macros.

You already know what each macro achieves, so it should be easy to tie in what you know about the macro(s), to the features you see in the printout; you'll be coming at VBA from both directions.

I know of at least one VBA programmer on Eileen's Lounge who still records a macro and then pores (paws?) over its entrails to work out how it is done.

Cheers
Chris
An expensive day out: Wallet and Grimace