[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.vb.general.discussion

VBA To set folder in MSWord

Karen Hart

3/7/2012 7:27:00 PM

I have a field in each record of an MSAccess database that contains
the path for saving msword
docs called txtPathForWordDocs. I have a command button that runs a
vba procedure that assembles a document in MSWord and leaves the user
in MSWord with the document on screen. When and if the user chooses to
save that document, I would like MSWord to save the doc to the folder
referenced in txtPathForWordDocs.

How can I pass the info in txtPathForWordDocs and therefore and set
the directory for saving to MSWord ?

I posted this in the .access group, but so far, all I hear is crickets
chirping.
Thank you!
9 Answers

Jeff Johnson [MVP: VB]

3/7/2012 9:43:00 PM

0

"Karen Hart" <hartofhearing@gmail.com> wrote in message
news:6d361be3-259a-4775-924e-f35063003a7c@y17g2000yqg.googlegroups.com...

>I have a field in each record of an MSAccess database that contains
> the path for saving msword
> docs called txtPathForWordDocs. I have a command button that runs a
> vba procedure that assembles a document in MSWord and leaves the user
> in MSWord with the document on screen. When and if the user chooses to
> save that document, I would like MSWord to save the doc to the folder
> referenced in txtPathForWordDocs.
>
> How can I pass the info in txtPathForWordDocs and therefore and set
> the directory for saving to MSWord ?
>
> I posted this in the .access group, but so far, all I hear is crickets
> chirping.
> Thank you!

I seriously doubt there is a way to "pre-set" the output folder in Word. You
can probably control it if you are forcing the Save As dialog box to
display, but I'd be very surprised to find that you can set it "in the
background" and then have that folder be the active one when the user
eventually goes to save.

Also, I have to comment on how horrific it is that a field in a database
starts with "txt."


Karl E. Peterson

3/7/2012 11:15:00 PM

0

on 3/7/2012, Karen Hart supposed :
> How can I ... set the directory for saving to MSWord ?
>
> I posted this in the .access group, but so far, all I hear is crickets
> chirping.

I'd suggest you try in microsoft.public.word.vba.general, although I
tend to agree with Jeff that the odds of doing that are pretty slim.

--
..NET: It's About Trust!
http://vfre...


mm

3/8/2012 1:58:00 AM

0

"Karen Hart" <hartofhearing@gmail.com> escribió en el mensaje
news:6d361be3-259a-4775-924e-f35063003a7c@y17g2000yqg.googlegroups.com...
>I have a field in each record of an MSAccess database that contains
> the path for saving msword
> docs called txtPathForWordDocs. I have a command button that runs a
> vba procedure that assembles a document in MSWord and leaves the user
> in MSWord with the document on screen. When and if the user chooses to
> save that document, I would like MSWord to save the doc to the folder
> referenced in txtPathForWordDocs.
>
> How can I pass the info in txtPathForWordDocs and therefore and set
> the directory for saving to MSWord ?

May be this: http://support.microsoft.com/kb/19...


GS

3/8/2012 4:28:00 AM

0

Karen Hart laid this down on his screen :
> I have a field in each record of an MSAccess database that contains
> the path for saving msword
> docs called txtPathForWordDocs. I have a command button that runs a
> vba procedure that assembles a document in MSWord and leaves the user
> in MSWord with the document on screen. When and if the user chooses to
> save that document, I would like MSWord to save the doc to the folder
> referenced in txtPathForWordDocs.
>
> How can I pass the info in txtPathForWordDocs and therefore and set
> the directory for saving to MSWord ?
>
> I posted this in the .access group, but so far, all I hear is crickets
> chirping.
> Thank you!

Since you are automating Word to display the assembled document, you
can also use automation to 'SaveAs' to a specified path and filename.
For how to do in VBA, open Word and in its VBE look up methods of the
Document object. I'm sure you'll find something like...

ActiveDocument.SaveAs <PathAndFilename, plus other parameters..>

--
Garry

Free usenet access at http://www.eternal-sep...
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


Karen Hart

3/8/2012 8:13:00 AM

0

On Mar 7, 5:58 pm, "Eduardo" <m...@mm.com> wrote:
> "Karen Hart" <hartofhear...@gmail.com> escribió en el mensajenews:6d361be3-259a-4775-924e-f35063003a7c@y17g2000yqg.googlegroups.com...
>
> >I have a field in each record of an MSAccess database that contains
> > the path for saving msword
> > docs called txtPathForWordDocs. I have a command button that runs a
> > vba procedure that assembles a document in MSWord and leaves the user
> > in MSWord with the document on screen. When and if the user chooses to
> > save that document, I would like MSWord to save the doc to the folder
> > referenced in txtPathForWordDocs.
>
> > How can I pass the info in txtPathForWordDocs and therefore and set
> > the directory for saving to MSWord ?
>
> May be this:http://support.microsoft.com/kb/19...

THANK YOU! PERFECT! PSHAW TO YOU NAY-SAYERS!

Dee Earley

3/8/2012 9:06:00 AM

0

On 08/03/2012 08:13, Karen Hart wrote:
> On Mar 7, 5:58 pm, "Eduardo"<m...@mm.com> wrote:
>> "Karen Hart"<hartofhear...@gmail.com> escribió en el mensajenews:6d361be3-259a-4775-924e-f35063003a7c@y17g2000yqg.googlegroups.com...
>>
>>> I have a field in each record of an MSAccess database that contains
>>> the path for saving msword
>>> docs called txtPathForWordDocs. I have a command button that runs a
>>> vba procedure that assembles a document in MSWord and leaves the user
>>> in MSWord with the document on screen. When and if the user chooses to
>>> save that document, I would like MSWord to save the doc to the folder
>>> referenced in txtPathForWordDocs.
>>
>>> How can I pass the info in txtPathForWordDocs and therefore and set
>>> the directory for saving to MSWord ?
>>
>> May be this:http://support.microsoft.com/kb/19...
>
> THANK YOU! PERFECT! PSHAW TO YOU NAY-SAYERS!

I'd rather you not clobber my "documents" path though for your local
change...

"Don't use a global state to manage a local problem"
http://blogs.msdn.com/b/oldnewthing/archive/2008/12/11/91...

--
Deanna Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

Clive Lumb

3/8/2012 10:46:00 AM

0



"Deanna Earley" <dee.earley@icode.co.uk> a écrit dans le message de groupe
de discussion : jj9spl$c41$2@speranza.aioe.org...
> On 08/03/2012 08:13, Karen Hart wrote:
>> On Mar 7, 5:58 pm, "Eduardo"<m...@mm.com> wrote:
>>> "Karen Hart"<hartofhear...@gmail.com> escribió en el
>>> mensajenews:6d361be3-259a-4775-924e-f35063003a7c@y17g2000yqg.googlegroups.com...
>>>
>>>> I have a field in each record of an MSAccess database that contains
>>>> the path for saving msword
>>>> docs called txtPathForWordDocs. I have a command button that runs a
>>>> vba procedure that assembles a document in MSWord and leaves the user
>>>> in MSWord with the document on screen. When and if the user chooses to
>>>> save that document, I would like MSWord to save the doc to the folder
>>>> referenced in txtPathForWordDocs.
>>>
>>>> How can I pass the info in txtPathForWordDocs and therefore and set
>>>> the directory for saving to MSWord ?
>>>
>>> May be this:http://support.microsoft.com/kb/19...
>>
>> THANK YOU! PERFECT! PSHAW TO YOU NAY-SAYERS!
>
> I'd rather you not clobber my "documents" path though for your local
> change...
>
> "Don't use a global state to manage a local problem"
> http://blogs.msdn.com/b/oldnewthing/archive/2008/12/11/91...
>
> --
> Deanna Earley (dee.earley@icode.co.uk)
> i-Catcher Development Team
> http://www.icode.co.uk...
>
> iCode Systems
>
> (Replies direct to my email address will be ignored.
> Please reply to the group.)

As ever, when playing with Application or OS settings:
Get current settings (Printer, orientation, paths, screen resolution,
....)
Save current settings
Change settings
.... Do cool stuff
Restore saved settings (Here and at any other exit points)



Jeff Johnson [MVP: VB]

3/8/2012 2:44:00 PM

0

"Karen Hart" <hartofhearing@gmail.com> wrote in message
news:5ba1b59c-f46f-416c-b231-175ca2afdf26@j8g2000yqm.googlegroups.com...

> >I have a field in each record of an MSAccess database that contains
> > the path for saving msword
> > docs called txtPathForWordDocs. I have a command button that runs a
> > vba procedure that assembles a document in MSWord and leaves the user
> > in MSWord with the document on screen. When and if the user chooses to
> > save that document, I would like MSWord to save the doc to the folder
> > referenced in txtPathForWordDocs.
>
> > How can I pass the info in txtPathForWordDocs and therefore and set
> > the directory for saving to MSWord ?
>
> May be this:http://support.microsoft.com/kb/19...

> THANK YOU! PERFECT! PSHAW TO YOU NAY-SAYERS!

And pshaw to the possibility that I will even consider answering your posts
in the future.

This solution is awful, by the way. It's as bad as changing the default
printer in VB to work with the Printer common dialog.


Karl E. Peterson

3/8/2012 6:36:00 PM

0

Karen Hart formulated the question :
> On Mar 7, 5:58 pm, "Eduardo" <m...@mm.com> wrote:
>> "Karen Hart" <hartofhear...@gmail.com> escribió en el
>> mensajenews:6d361be3-259a-4775-924e-f35063003a7c@y17g2000yqg.googlegroups.com...
>>
>>> I have a field in each record of an MSAccess database that contains
>>> the path for saving msword
>>> docs called txtPathForWordDocs. I have a command button that runs a
>>> vba procedure that assembles a document in MSWord and leaves the user
>>> in MSWord with the document on screen. When and if the user chooses to
>>> save that document, I would like MSWord to save the doc to the folder
>>> referenced in txtPathForWordDocs.
>>
>>> How can I pass the info in txtPathForWordDocs and therefore and set
>>> the directory for saving to MSWord ?
>>
>> May be this:http://support.microsoft.com/kb/19...
>
> THANK YOU! PERFECT! PSHAW TO YOU NAY-SAYERS!

Huh? You think changing the user's default document location is a good
solution? Are you going to make their desktop pink as well?

I'm sorry, I had assumed you wanted a *non-destructive* solution. My
bad. <eye roll>

--
..NET: It's About Trust!
http://vfre...