L
Lee
Hello
I am using Word2003, Visual Basic 6.4
I have a UserForm that successfully populates a number of bookmarks within a
document.
I would like to reuse two of these variables, "Client" and "InvYear" within
the document filename when saved.
The SaveAs FileName statement is called, after the UserForm, within my
Private Sub Document_New() section and looks like this (Order being an
automatically incremented invoice number.):
ActiveDocument.SaveAs FileName:="F:\My Documents\Invoice" & Client & InvYear
& Format(Order, "00#")
However, the files are being saved as F:\My Documents\Invoice008 and so on.
The Client and InvYear variables are not coming through.
I tried converting all the UserForm subroutines from Private to Public but
this didn't work. I have also tried creating new variables varClient and
varInvYear within the UserForm Private Sub CommandButton1_Click() in the
hope that these would come through even after the UserForm was closed. This
did not work.
I think I have two choices:
a) Find out how to create general variables that stay within the document
even after the UserForm is closed, or
b) Re-read the contents of the bookmarks once inserted in order to insert
them into the file name.
can anybody help me out here? I am a little stuck now.
Thanks
Lee
I am using Word2003, Visual Basic 6.4
I have a UserForm that successfully populates a number of bookmarks within a
document.
I would like to reuse two of these variables, "Client" and "InvYear" within
the document filename when saved.
The SaveAs FileName statement is called, after the UserForm, within my
Private Sub Document_New() section and looks like this (Order being an
automatically incremented invoice number.):
ActiveDocument.SaveAs FileName:="F:\My Documents\Invoice" & Client & InvYear
& Format(Order, "00#")
However, the files are being saved as F:\My Documents\Invoice008 and so on.
The Client and InvYear variables are not coming through.
I tried converting all the UserForm subroutines from Private to Public but
this didn't work. I have also tried creating new variables varClient and
varInvYear within the UserForm Private Sub CommandButton1_Click() in the
hope that these would come through even after the UserForm was closed. This
did not work.
I think I have two choices:
a) Find out how to create general variables that stay within the document
even after the UserForm is closed, or
b) Re-read the contents of the bookmarks once inserted in order to insert
them into the file name.
can anybody help me out here? I am a little stuck now.
Thanks
Lee