Re: Getting from Access to Word



OH we will need to get rid of the other code you are not using so you
can make a new db and just put this in or if this is the only code get
rid of the rest and then go to the debug tab and press compile. We
could be getting errors from the other code.
Lewie
lewie wrote:
We haven't hooked up the button yet we will do this in steps.
do you know how to use debug menu? in code window using the
view/menu/debug selection will place the debug menu at the top. and if
you hover over the selection with the writing and the arrow it will say
"step into". when you click it it will step through the code.
so palce the cursor on the call newtest line and start stepping. When
you get to the
Documents.Open FileName:=defaultDir & "TEST.DOC"
line and click it should open the document. Ok.
Lewie
Susan H. White wrote:
Lewie, I created a second module for Public Sub newtest() as you directed.
Again triple checked. Included each line except your"OK this will open a test
document . . ." and "this will run it, etc. . . ." Created a test.doc file in
C drive and tested that by the Run process. Then I created a test.doc
pathway in my list box. Then held my breath and pushed the button and . . . .
nothing! Went back to step through the module and I get right away "Compile
Error, variable not defined." Susan

"lewie" wrote:

Public Sub newtest()


defaultDir = "C:\" 'Options.DefaultFilePath(wdDocumentsPath)
defaultDir = defaultDir '+ "Test.doc"
With Application.FileSearch
.FileName = "Test.doc"
.LookIn = defaultDir
.Execute
If .FoundFiles.Count = 1 Then
Documents.Open FileName:=defaultDir & "TEST.DOC"
Else
MsgBox "Test.doc file was not found"
End If
End With
End Sub
ok this will open a text doc named test.doc in c: drive
Public Function x()
Call newtest
End Function
this will run it
then when this is working all we have to do is assign what is in the
dropdown to these values
put this code in module and step thru it.
using the debug bar.

Lewie
Rick Brandt wrote:
"Susan H. White" <SusanHWhite@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:EC2E22E0-C804-45ED-9603-BC60B8E1D2A9@xxxxxxxxxxxxxxxx
In a form, I have a listbox based on a table that contains Section,
Subsection, Page and Pathway. What I want to have happen is that selecting
one of the lines in the listbox automatically activates the Pathway so that
the specified document comes up in WORD.

I'm just unable to do this, despite hours of frustration with macros,
coding, etc. Can anyone help?

What code are you using now? I would expect something like...

Application.FollowHyperLink Me.ListBoxName.Column(3)

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com



.