Re: Word Programming - issue with Word versions and automation
- From: IdontWantSpam@xxxxxxxxxx (Edward Thrashcort)
- Date: Sun, 18 Sep 2005 01:40 +0100 (BST)
> I know, have you read the whole thread or just the part where you jumped
Evidently I may have missed some messages.
Apologies. I had not associated that message with you.
> > Keep up Bond!
>
> Was that really necessary?
Maybe you don't understand English humour? It was meant as a friendly
rebuke - albeit that it turned out I was wrong!
No offense intended.
I'm glad the the problem is solved by compiling only in 2003. However I am
surprised that Jon West's suggestion works - it will still work in earlier
version. I assume it's being distributed as an executable addin?
Eddie
> Edward Thrashcort was telling us:
> Edward Thrashcort nous racontait que :
>
> > Keep up Bond!
>
> Was that really necessary?
>
> > We are talking about statements is higher versions of Word causing
> > compiler errors in earlier versions EVEN when inside regular If blocks
>
> I know, have you read the whole thread or just the part where you jumped
> in? Just in case, here is what I wrote earlier, complete with all the
> syntactical, spelling and grammatical errors:
>
> <quote>
> Sorry about your situation, but, I created the code I posted in a Word
> 2003
> document, saved it and ran the code.
> Then, I opened the document with Word 97 and Word 2000 and ran the code
> without any problems...
>
> I have done this kind of thing before and never had any problems, so I do
> not understand why you are having problems with this.
>
> Conditioning compiling (#If) is normally used for making a difference
> between a Mac or a PC machine, but regular conditional branching has
> always
> worked for my purposes. I guess this is why there are no Compiler
> constants
> for Word versions, they are not necessary.
>
> Of course I cannot compile this code under Word 2000 or 97, but why would
> I
> want to? I coded,debugged and compiled the whole thing in Word 2003.
> When you run the code, the compiler only compiles the Subs/Functions you
> call, this is why I suggested calling the appropriate Sub according to the
> version you are running, as in my example.
>
> I mean, the following code will not work:
>
> '_______________________________________
> Sub test()
>
> Dim myVer As Long
> myVer = Val(Left$(Application.Version, 1))
>
> With ActiveDocument
> MyName = Left(.FullName, Len(.FullName) - 4) & "_New.doc"
> End With
>
> Select Case myVer
> Case 1
> ActiveDocument.SaveAs FileName:=MyName, InsertLineBreaks:=True
> Case 8, 9 '97 or 2000
> ActiveDocument.SaveAs FileName:=MyName
> Case Else
> MsgBox "I don't know what you are running."
> End Select
>
> End Sub
> '_______________________________________
>
> But the code I have already posted will.
> Why did you not try it?
> Or if you did, what kind of error message did you get?
> </quote>
>
> And the code I refer to from an earlier mesaage is:
> <quote>
> '_______________________________________
> Public MyName As String
>
> '_______________________________________
> Sub test()
>
> Dim myVer As Long
> myVer = Val(Left$(Application.Version, 1))
>
> With ActiveDocument
> MyName = Left(.FullName, Len(.FullName) - 4) & "_New.doc"
> End With
>
> Select Case myVer
> Case 1
> WordXpAndMore
> Case 8, 9 '97 or 2000
> Word2000AndMinus
> Case Else
> MsgBox "I don't know what you are running."
> End Select
>
> End Sub
> '_______________________________________
>
> '_______________________________________
> Sub Word2000AndMinus()
>
> ActiveDocument.SaveAs FileName:=MyName
>
> End Sub
> '_______________________________________
>
> '_______________________________________
> Sub WordXpAndMore()
>
> ActiveDocument.SaveAs FileName:=MyName, InsertLineBreaks:=True
>
> End Sub
> '_______________________________________
> </quote>
>
> Would you care to test it on various versions of Word? It did work for me
> on Word 2003, Word 2000 and Word 97.
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@xxxxxxxxxxxxxxxxxxxxxxx
> Word MVP site: http://www.word.mvps.org
>
>
>
.
- Follow-Ups:
- Re: Word Programming - issue with Word versions and automation
- From: Jean-Guy Marcil
- Re: Word Programming - issue with Word versions and automation
- References:
- Re: Word Programming - issue with Word versions and automation
- From: Jean-Guy Marcil
- Re: Word Programming - issue with Word versions and automation
- Prev by Date: Mail merge
- Next by Date: Re: Word Programming - issue with Word versions and automation
- Previous by thread: Re: Word Programming - issue with Word versions and automation
- Next by thread: Re: Word Programming - issue with Word versions and automation
- Index(es):
Relevant Pages
|