vba to save word doc as

K

kevin.witty

I've used Albert D. Kallal's brilliant Merge20 to help me create a word
merge document, which ends up named "Form Letters 1". I can't figure out
the sytax to save that doc with a new name from within vba in Access. (In
fact I can't figure out how to do much of anything with Word vba since I get
no intellisense there, and I can't find where it's documented!!) If anyone
can help me with the sytax, I'll appreciate it. If anyone can pint to where
the documentation is, or how to get intellisense turned on I may not have to
ask questions like this again <g>. Thanks, Kevin
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Hi Kevin,

I would be more certain about this is you had pasted the actual bit of
Albert's code that you are using. I have taken a guess however and after
the following lines of code:

WordApp.Visible = True
WordApp.Windows(WordApp.Windows.Count).Activate

clsRidesPBar.HideProgress

AppActivate "Microsoft Word"
WordApp.WindowState = 0 'wdWindowStateRestore

you should add

WordApp.ActiveDocument.SaveAs "filename"

You don't get the intellisense because Albert's code uses late binding which
has the advantage that it makes the code independent of the version of Word.

If you use early binding, you will get intellisense, but you will have to
set a reference to the Word Object Model.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
 
K

kevin.witty

Thanks, Doug... good guess about where I was, and it worked a treat.

Where is this stuff documented? Or, can I write the code using late binding
and intellisense, and then switch to early binding when it works (assuming I
don't use stuff which doesn't belong in both models?) I have a references
set to both Access 10 and Word 10 but don't know how to dim an object to use
intellisense with them, and MS's Help, of course, doesn't.
 
C

Cindy M -WordMVP-

Or, can I write the code using late binding
and intellisense, and then switch to early binding when it works
I think you mean it the other way around :) Early binding to see the
intellisense; late binding to make the module "independent".
I have a references
set to both Access 10 and Word 10 but don't know how to dim an object to use
intellisense with them
Dim Wordapp as Word.Application

I'm not certain that you need Access? I'm not familiar with the code you're
referencing, but I'd be more inclined to think you need a reference to dAO or
perhaps ADO.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top