Home All Groups Group Topic Archive Search About
Author
9 Dec 2008 4:30 PM
dweiters
I have created a simple Word template with bookmarks for entering
text.  I receive "Runtime Error 91 Object variable or With block
variable not set" when I click the OK button.  The template info
populates into the Word form nonetheless.  I believe I need a Set
command, but am not sure what I need or how to write it, as I am a
novice at VB.

Private Sub Document_New()
  frmSeminarRequest.Show
End Sub

Can anyone recommend a fix for this error?  Thanks in advance

Author
9 Dec 2008 4:52 PM
Jan Hyde (VB MVP)
dweit***@dowlohnes.com's wild thoughts were released on Tue,
9 Dec 2008 08:30:41 -0800 (PST) bearing the following fruit:

>I have created a simple Word template with bookmarks for entering
>text.  I receive "Runtime Error 91 Object variable or With block
>variable not set" when I click the OK button.  The template info
>populates into the Word form nonetheless.  I believe I need a Set
>command, but am not sure what I need or how to write it, as I am a
>novice at VB.
>
>Private Sub Document_New()
>  frmSeminarRequest.Show
> End Sub
>
>Can anyone recommend a fix for this error?  Thanks in advance

You need to post the line of code the error occurs on.
--
Jan Hyde (VB MVP)

https://mvp.support.microsoft.com/profile/Jan.Hyde
Author
9 Dec 2008 5:11 PM
dweiters
On Dec 9, 11:52 am, "Jan Hyde (VB MVP)"
<StellaDrin***@REMOVE.ME.uboot.com> wrote:
Show quoteHide quote
> dweit***@dowlohnes.com's wild thoughts were released on Tue,
> 9 Dec 2008 08:30:41 -0800 (PST) bearing the following fruit:
>
> >I have created a simple Word template with bookmarks for entering
> >text.  I receive "Runtime Error 91 Object variable or With block
> >variable not set" when I click the OK button.  The template info
> >populates into the Word form nonetheless.  I believe I need a Set
> >command, but am not sure what I need or how to write it, as I am a
> >novice at VB.
>
> >Private Sub Document_New()
> >  frmSeminarRequest.Show
> > End Sub
>
> >Can anyone recommend a fix for this error?  Thanks in advance
>
> You need to post the line of code the error occurs on.
> --
> Jan Hyde (VB MVP)
>
> https://mvp.support.microsoft.com/profile/Jan.Hyde

error appears on frmSeminarRequest.Show line is highlighted.
Author
9 Dec 2008 5:50 PM
amdrit
I think what Jan was getting at was that something happens in
frmSeminarRequest (Load, Initialize) that is causing an issue.  Put a break
point out there and step through, or put error trapping out there to report
where the issue is coming from.

Generically speaking error 91 means an object was not set or initiliazed
before attempting to use it.  So if frmSeminarRequest is initialized, then
it should be an object you are attempting to access in the load or initilize
events of the form.



<dweit***@dowlohnes.com> wrote in message
news:ccc5266c-d988-457a-a91e-5a2bda763301@e3g2000vbe.googlegroups.com...
On Dec 9, 11:52 am, "Jan Hyde (VB MVP)"
<StellaDrin***@REMOVE.ME.uboot.com> wrote:
Show quoteHide quote
> dweit***@dowlohnes.com's wild thoughts were released on Tue,
> 9 Dec 2008 08:30:41 -0800 (PST) bearing the following fruit:
>
> >I have created a simple Word template with bookmarks for entering
> >text. I receive "Runtime Error 91 Object variable or With block
> >variable not set" when I click the OK button. The template info
> >populates into the Word form nonetheless. I believe I need a Set
> >command, but am not sure what I need or how to write it, as I am a
> >novice at VB.
>
> >Private Sub Document_New()
> > frmSeminarRequest.Show
> > End Sub
>
> >Can anyone recommend a fix for this error? Thanks in advance
>
> You need to post the line of code the error occurs on.
> --
> Jan Hyde (VB MVP)
>
> https://mvp.support.microsoft.com/profile/Jan.Hyde

error appears on frmSeminarRequest.Show line is highlighted.
Author
9 Dec 2008 9:05 PM
dweiters
Show quote Hide quote
On Dec 9, 12:50 pm, "amdrit" <amd***@hotmail.com> wrote:
> I think what Jan was getting at was that something happens in
> frmSeminarRequest (Load, Initialize) that is causing an issue.  Put a break
> point out there and step through, or put error trapping out there to report
> where the issue is coming from.
>
> Generically speaking error 91 means an object was not set or initiliazed
> before attempting to use it.  So if frmSeminarRequest is initialized, then
> it should be an object you are attempting to access in the load or initilize
> events of the form.
>
> <dweit***@dowlohnes.com> wrote in message
>
> news:ccc5266c-d988-457a-a91e-5a2bda763301@e3g2000vbe.googlegroups.com...
> On Dec 9, 11:52 am, "Jan Hyde (VB MVP)"
>
>
>
>
>
> <StellaDrin***@REMOVE.ME.uboot.com> wrote:
> > dweit***@dowlohnes.com's wild thoughts were released on Tue,
> > 9 Dec 2008 08:30:41 -0800 (PST) bearing the following fruit:
>
> > >I have created a simple Word template with bookmarks for entering
> > >text. I receive "Runtime Error 91 Object variable or With block
> > >variable not set" when I click the OK button. The template info
> > >populates into the Word form nonetheless. I believe I need a Set
> > >command, but am not sure what I need or how to write it, as I am a
> > >novice at VB.
>
> > >Private Sub Document_New()
> > > frmSeminarRequest.Show
> > > End Sub
>
> > >Can anyone recommend a fix for this error? Thanks in advance
>
> > You need to post the line of code the error occurs on.
> > --
> > Jan Hyde (VB MVP)
>
> >https://mvp.support.microsoft.com/profile/Jan.Hyde
>
> error appears on frmSeminarRequest.Show line is highlighted.- Hide quoted text -
>
> - Show quoted text -

Thanks Amdrit.  That sorta makes sense to me (novice), but I'm unclear
on how to set the object variable or what the next line of code should
be.
Author
10 Dec 2008 1:41 AM
Ken Halter
Set a breakpoint on this line...

> > > frmSeminarRequest.Show

When VB stops on that line, right click the code window and select
Toggle/Break On Unhandled Errors... then, hit F5 to continue running. VB
should then stop on the line that actually raised the error.

If "frmSeminarRequest" is a variable name, and not an actual form's name,
you will need that "Set" statement you mentioned. It would look like...

Set frmSeminarRequest = New ActualNameOfForm
frmSeminarRequest.Show

<dweit***@dowlohnes.com> wrote in message
news:b791796a-ca7f-433e-ab01-5658a39161a8@r34g2000vbp.googlegroups.com...
On Dec 9, 12:50 pm, "amdrit" <amd***@hotmail.com> wrote:

Thanks Amdrit.  That sorta makes sense to me (novice), but I'm unclear
on how to set the object variable or what the next line of code should
be.
Author
10 Dec 2008 2:25 AM
Bill McCarthy
Hi dweiters,

What is frmSeminarRequest ?  Are you sure the name is correct ?  Try adding
Option Explicit to the code module and see if it gives you an error.


<dweit***@dowlohnes.com> wrote in message
Show quoteHide quote
news:6b742825-4430-4796-a89c-c1d7fddd16f3@r32g2000vba.googlegroups.com...
>I have created a simple Word template with bookmarks for entering
> text.  I receive "Runtime Error 91 Object variable or With block
> variable not set" when I click the OK button.  The template info
> populates into the Word form nonetheless.  I believe I need a Set
> command, but am not sure what I need or how to write it, as I am a
> novice at VB.
>
> Private Sub Document_New()
>  frmSeminarRequest.Show
> End Sub
>
> Can anyone recommend a fix for this error?  Thanks in advance