Why does this code fail?

D

Dale

Hello all,

Would someone be so kind as to look at the following and tell me why this
code is intermittent/fails? Is my logic faulty?



With Dialogs(wdDialogFileSaveAs)

If Dir("J:\LASER\" & PATH & "\") <> "" Then

.Name = "J:\LASER\" & PATH & "\LaserAddressSimulation.doc"

Else

.Name = "J:\LASER\LaserAddressSimulation.doc"

End If

.Display
.Execute

End With
 
D

Doug Robbins - Word MVP

I would use:

Dim Path As String, fname As String
If Dir("J:\LASER\" & Path & "\") <> "" Then
fname = "J:\LASER\" & Path & "LaserAddressSimulation.doc"
Else
fname = "J:\LASER\LaserAddressSimulation.doc"
End If
ActiveDocument.SaveAs fname


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
D

Doug Robbins - Word MVP

It wasn't necessary.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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