Re: VBA doesn't recognised mid(..) and left(..)
From: Peter Hewett (nospam_at_xtra.co.nz)
Date: 03/14/04
- Next message: Dave Neve: "Re: Att: Peter Hewett: ascii 134"
- Previous message: Helmut Weber: "Paragraph border lines do not print"
- In reply to: Neil Penn: "Re: VBA doesn't recognised mid(..) and left(..)"
- Next in thread: Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL ADDRESS: "Re: VBA doesn't recognised mid(..) and left(..)"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 14 Mar 2004 23:39:31 +1300
Hi Neil Penn
As Doug said, renaming a Word document or template does not change the way Word
recognises it. Word looks at the binary data contained in a file and not the
file type. When you create a new document based on a document Word propagates
any code contained in the document. The new documents Attached Template will be
the same as its parent document.
You should not need to use explicit references VBA.String.whatever, it looks
like the template/document is corrupt.
Good luck - Peter
"Neil Penn" <neil.penn@btinternet.com>, said:
>
>Thanks for the link below. The explanation given there is to do with a
>missing reference, which doesn't seem to directly explain why renaming a
>document to a template will cause the problem - in the new document created
>fro the template the VBA references do all appear to be set the same as they
>were in the original .DOC document.
>
>I found that if I added in full references to the functions - for example
>VBA.String.Mid(..) or VBA.String.Left(..) then it worked ok.
>
>I would conclude that using rename to create a template must create a
>problem with the references for the VBA project.
>
>Thanks for your help.
>
>"Peter Hewett" <nospam@xtra.co.nz> wrote in message
>news:dr1250dti4t8gmf8bkiv8ba8n2grtnbk5i@4ax.com...
>> Hi Neil Penn
>>
>> Check out the following link:
>>
>> Undefined Variable: Mid, Left, Right not working
>> http://word.mvps.org/faqs/apperrors/MidNotWorking.htm
>>
>> HTH + Cheers - Peter
>>
>>
>> "Neil Penn" <neil.penn@btinternet.com>, said:
>>
>> >Word 2000
>> >Windows 2000
>> >
>> >This is really weird.
>> >
>> >This evening I wrote a VBA macro to go to a database to bring back data
>and
>> >replace some values in a Word document.
>> >
>> >I developed the macro in a .DOC until it all ran ok, then renamed the
>> >document to a .DOT for final use.
>> >
>> >When I went to test the .DOT things went very strange. First none of the
>> >enumerations or constants were being recognised - for example adStateOpen
>> >for ADO wasn't recognised and the Microsoft Scripting constant for
>opening a
>> >text file for reading wasn't recognised either. OK - I just wrote local
>> >variables to re-define the constants to get around that problem. What
>really
>> >through me was when VBA said it didn't recognised mid(..) and left(..)
>> >functions. At this point I went home.
>> >
>> >I am hoping that when I get in tomorrow a reboot will sort everything
>out,
>> >but if not can anyone think what has caused the problem?
>> >
>> >I should add that the references are still all in the project. If I hit
>F2 I
>> >can find all the references it says it doesn't recognise.
>> >
>> >I really need it to run as a .DOT as the code runs about replacing
>> >placeholders with database data so I don't want to change the original
>> >document.
>> >
>>
>
HTH + Cheers - Peter
- Next message: Dave Neve: "Re: Att: Peter Hewett: ascii 134"
- Previous message: Helmut Weber: "Paragraph border lines do not print"
- In reply to: Neil Penn: "Re: VBA doesn't recognised mid(..) and left(..)"
- Next in thread: Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL ADDRESS: "Re: VBA doesn't recognised mid(..) and left(..)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|