WordBasic causes 'Remote Server does not exist' on 2nd run!

L

Laphan

Hi All

I know this is a Word VBA group, but because the VBA DocProperties command
to set the SaveAs Filename doesn't actually work when you run the command
from VB6, my VB6 app generates pre-populated MS Word docs and I want to
pre-populate the Save filename box as well without saving the actual doc, it
appeared that my only option was to use:

WordBasic.SetDocumentProperty "Title", 0, strWordFilename, 1

This works fine on my first run, but if the user clicks the button on my app
again (they may do this several times in one session) my app generates the
error message:

The remote server machine does not exist or is unavailable error 462

If I take out this single line of code then everything works fine again, ie
I can generate thousands of new Word docs, but obviously my bespoke SaveAs
filename won't appear.

It's as if I need to kill the WordBasic entity so that each time the button
is clicked WordBasic starts afresh.

Any ideas?
 
L

Laphan

Apols I've been mulling over it for about 2.5 hours and then I've just seen
something that got the grey cells moving again.

My top tip for every numpty programmer like me, don't just copy and paste
code that somebody has sent you straight into your code and expect it to
work!!

I hadn't *tied* the WordBasic command line to my Word object so I'd created
a rogue orphan - sorted - thank goodness!

Rgds


Hi All

I know this is a Word VBA group, but because the VBA DocProperties command
to set the SaveAs Filename doesn't actually work when you run the command
from VB6, my VB6 app generates pre-populated MS Word docs and I want to
pre-populate the Save filename box as well without saving the actual doc, it
appeared that my only option was to use:

WordBasic.SetDocumentProperty "Title", 0, strWordFilename, 1

This works fine on my first run, but if the user clicks the button on my app
again (they may do this several times in one session) my app generates the
error message:

The remote server machine does not exist or is unavailable error 462

If I take out this single line of code then everything works fine again, ie
I can generate thousands of new Word docs, but obviously my bespoke SaveAs
filename won't appear.

It's as if I need to kill the WordBasic entity so that each time the button
is clicked WordBasic starts afresh.

Any ideas?
 

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