View Full Version : Solved: SaveAs
Merkava
09-16-2006, 03:43 AM
Hi folks,
Iam trying to press a button and have my form saved in another place.
Here is the code:
Private Sub cmdSpiral_Click()
Dim strFilename As String
strFilename = "d:/" & txtAccount.Text & ".doc"
Me.SaveAs strFilename, wdFormatText
End Sub
I am receiving "Run time error 4198" command failed. any tips.
T.I.A.
Aaron
Ken Puls
09-16-2006, 09:56 AM
Hi Aaron,
When you say "form", are you talking about a document that you designed, or an actual userform that you designed in the VBE?
If its a userform, you'll need to export it to file. If it's a document, I would think that modifying it to this (untested) should work:
Private Sub cmdSpiral_Click()
Dim strFilename As String
strFilename = "d:/" & txtAccount.Text & ".doc"
ThisDocument.SaveAs strFilename, wdFormatText
End Sub
(Might be ActiveDocument instead of ThisDocument.)
PS... I've edited your post to use our VBA tags. a
Merkava
09-16-2006, 10:56 AM
I, for some reason created a template from scratch and used vba in it to perform several functions, such ensuring that certain fields are filled in prior to allowing the user to save the document/form
fumei
09-17-2006, 04:29 PM
That is nice, but it hardly answered the question.
"Me" would make most of us think userform.
Ken is correct, if it is a document you are saving, it would be ActiveDocument.SaveAs.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.