(Msg. 1) Posted: Wed Apr 30, 2008 9:30 am
Post subject: Compile Error Archived from groups: microsoft>public>word>vba>userforms (more info?)
I have the following code "With
ActiveDocument.bookmarks(txtWorkNo).Range.InsertBefore(TextBox1)". And I
receive a Compile Error: Expected Function or variable. It highlights the
".InsertBefore" in the code. What did I miss that this error occurs?
(Msg. 2) Posted: Thu May 01, 2008 3:07 am
Post subject: Re: Compile Error [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
I assume that txtWorkNo is declared as a String somewhere in your code.
However, if it is actually the name of the bookmark, it must be enclosed in
quotation marks.
Also, in place of:
..InsertBefore(TextBox1)
You should have
..InsertBefore TextBox1
I assume that your code is actually arranged as follows
With ActiveDocument
.Bookmarks(etc)
.etc
End With
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
"TJ Bennett" <tbennett.DeleteThis@finishthompson.com> wrote in message
news:ecIZVZsqIHA.1228@TK2MSFTNGP05.phx.gbl...
>I have the following code "With
>ActiveDocument.bookmarks(txtWorkNo).Range.InsertBefore(TextBox1)". And I
>receive a Compile Error: Expected Function or variable. It highlights the
>".InsertBefore" in the code. What did I miss that this error occurs?
>
(Msg. 3) Posted: Fri May 09, 2008 6:08 pm
Post subject: Re: Compile Error [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
"TJ Bennett" <tbennett.RemoveThis@finishthompson.com> wrote in message
news:ecIZVZsqIHA.1228@TK2MSFTNGP05.phx.gbl...
>I have the following code "With
>ActiveDocument.bookmarks(txtWorkNo).Range.InsertBefore(TextBox1)". And I
>receive a Compile Error: Expected Function or variable. It highlights the
>".InsertBefore" in the code. What did I miss that this error occurs?
>
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum