RE: save and retrieve a text file from a command button

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jonathan Parminter (anonymous_at_discussions.microsoft.com)
Date: 10/24/04


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



Relevant Pages

  • Re: Memory Frage
    ... Peak Private Bytes: 232K ... extrn _WriteConsoleA@20: PROC ... push STD_OUTPUT_HANDLE ...
    (microsoft.public.de.vc)
  • Re: Re: Dynamically updating perl variables
    ... push @values, $1, $2; ... the things you want than to try to exclude the things you don't. ... private and confidential ... values of β ...
    (perl.beginners)
  • Whats being thrown away?
    ... In the following snippet of code I'm getting the "useless use of a private ... variable in a void context" error. ... push @days, $day; ...
    (perl.beginners)