Thanks guys for you help, am fumbling along & have got a bit further.
The following is part of my code as it is now
====================================================
Set objSht = .ActiveWorkbook.Worksheets("2. Components")
With objSht
rst.MoveFirst
Do Until rst.EOF
.Cells(rst!Row, 3).Value = rst!MeetStandard
.Cells(rst!Row, 4).Value = rst!Material
(a bunch more of these type of lines then... )
Range("V15").Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, _
Address:="PK06_001.JPG", TextToDisplay:="PK06_001.JPG (5)"
rst.MoveNext
Loop
End With
====================================================
What I now get is this...
First time I run it, it creates the hyperlink in the correct cell,
but in the wrong sheet (creates it in last sheet, not sheet 2).
Can you tell me why, I thought the active sheet was set above ?
It leaves an instance of Excel in memory, although it only opens
one instance irrespective of the number of times I run the code.
How do I ensure it closes ?
(The end of the sub looks like this...
objXL.Quit
ExitHere:
Set objXL = Nothing
Set objSht = Nothing
Set objWkb = Nothing
Set rst = Nothing
Set db = Nothing
Exit Sub
=====================================================
I thank you again for your help
Frank H
"James A. Fortune" wrote:
> Ken Snell MVP wrote:
> > "James A. Fortune" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >
> >
> >>Maybe (Air Code):
> >>
> >>Dim strYesterday As String
> >>Dim strLink As String
> >>
> >>strYesterday = Format(DateAdd("d", -1, Date()), "mm\.dd\.yyyy")
> >>strLink = "'http://www.merriam-webster.com/cgi-bin/mwwodarch.pl?" &
> >>strYesterday
> >>objXL.Range("A1").Select
> >>objWkb.ActiveSheet.Hyperlinks.Add Selection, strLink
> >>objWkb.ActiveCell.FormulaR1C1 = "Yesterday's Word of the Day: " & strLink
> >
> >
> > The use of .ActiveSheet and .ActiveCell will create new instances of EXCEL
> > in memory, and they'll continue running after the original EXCEL instance is
> > shut down. Always use fully qualified references when automating EXCEL from
> > ACCESS. Your code should create a worksheet object to represent the
> > worksheet that is the 'active one' and then use that object in the
> > reference. And you should use the worksheet object to reference a Range
> > object, which then would replace the ActiveCell reference.
>
> You might be right, but given that the creation of objWkb included a
> fully qualified reference to objXL, any objects referenced using objWkb
> will also be fully qualified and thus not create new instances of EXCEL
> in memory. Still, your suggestion is safer and it's better to be safe
> than scarry :-).
>
> James A. Fortune
> (E-Mail Removed)
>