RE: save and retrieve a text file from a command button
From: Jonathan Parminter (anonymous_at_discussions.microsoft.com)
Date: 10/24/04
- Next message: smk23: "Re: recordset syntax"
- Previous message: Jonathan Parminter: "Passing Control object to another code to 'Execute'"
- In reply to: david d: "save and retrieve a text file from a command button"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 23 Oct 2004 21:07:25 -0700
>-----Original Message-----
>I would like to open for editing a text or MSWord file
based upon the
>employee number and last name. I want to be able to
push a command button
>and Access look for a file and open it. If there is no
such file, create
>one and open it. Any suggestions.
>.
Hi David,
use the following as an example:
In declarations section of module (top)
private mWordApp as Object
private mWordDoc as object
sub OpenFile(DocPathAndName as string)
If GetWord() then
on error resume next
set mWordDoc=mWordApp.Documents.open DocPathAndName
if err<>0 then
' error (maybe) document does not exist
set mWordDoc=mWordApp.Documents.add
end if
end if
private function GetWord() as boolean
if mWordApp is nothing then
' reference ms word
on error resume next
set mWordApp=getobject(,"winword.application")
if err<>0 then
' ms word not already open
set mWordApp=New winword.application
end if
end if
getword=true
end if
Luck
Jonathan
- Next message: smk23: "Re: recordset syntax"
- Previous message: Jonathan Parminter: "Passing Control object to another code to 'Execute'"
- In reply to: david d: "save and retrieve a text file from a command button"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|