A
Amber_D_Laws
Hello,
I am new to the forum, and new to VBA. It is nice to have a place full
of such knowledgeable people!
So, right to it...
I have been creating a quote module for the project managers at my lab,
and none of them are very computer literate, and do not care to become
so. Needless to say making the module user friendly for them has been a
challenge. VBA so far has helped me by leaps and bounds, but I have hit
a snag.
I want them to save each new quote as a unique file once the quote
number has been updated and saved to the master file.
(pardon if my terminology is a little off, as I said, I am not a
professional programmer)
The code I have so far has been running great. It is for a command
button, that increases the quote number by one, and then saves the
file. This afternoon I started trying to figure out how to get it to
save to a unique file, and I am up against a wall. I have looked in my
VBA book, but they don't even mention "SaveAs", and looking online has
been like pulling teeth. I can't find consistant answers that tell me
how VBA is reading the information, and what I'm not giving it.
This is the code so far:
Private Sub CommandButton1_Click()
'Declares Variables of the file name for "SaveAs" function
Dim QNum As String
Dim CNam As String
Dim CrDt As String
Dim VNum As String
'Defines the variable names from Quote Form
QNum = "W10"
CNam = "N19"
CrDt = Format(Now, "mmddyy")
VNum = "AA10"
'Changes the Quote Number to Increase by 1
Range("W10").Value = Range("W10").Value + 1
Range("W10").Copy
Range("W10").PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
'Saves the New Quote Number to the Template
ActiveWorkbook.Save
'Saves the New Quote as a unique file
ActiveWorkbook.SaveAs "X:\_FEE SCHEDULE & QUOTE MODULE\" &
Str(QNum) & Str(CNam) & (CrDt) & " Ver" & Str(VNum)
End Sub
The debugger is coming up with a run time error, type mismatch.
Someone PLEASE help!
Thank you in advance.
I am new to the forum, and new to VBA. It is nice to have a place full
of such knowledgeable people!
So, right to it...
I have been creating a quote module for the project managers at my lab,
and none of them are very computer literate, and do not care to become
so. Needless to say making the module user friendly for them has been a
challenge. VBA so far has helped me by leaps and bounds, but I have hit
a snag.
I want them to save each new quote as a unique file once the quote
number has been updated and saved to the master file.
(pardon if my terminology is a little off, as I said, I am not a
professional programmer)
The code I have so far has been running great. It is for a command
button, that increases the quote number by one, and then saves the
file. This afternoon I started trying to figure out how to get it to
save to a unique file, and I am up against a wall. I have looked in my
VBA book, but they don't even mention "SaveAs", and looking online has
been like pulling teeth. I can't find consistant answers that tell me
how VBA is reading the information, and what I'm not giving it.
This is the code so far:
Private Sub CommandButton1_Click()
'Declares Variables of the file name for "SaveAs" function
Dim QNum As String
Dim CNam As String
Dim CrDt As String
Dim VNum As String
'Defines the variable names from Quote Form
QNum = "W10"
CNam = "N19"
CrDt = Format(Now, "mmddyy")
VNum = "AA10"
'Changes the Quote Number to Increase by 1
Range("W10").Value = Range("W10").Value + 1
Range("W10").Copy
Range("W10").PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
'Saves the New Quote Number to the Template
ActiveWorkbook.Save
'Saves the New Quote as a unique file
ActiveWorkbook.SaveAs "X:\_FEE SCHEDULE & QUOTE MODULE\" &
Str(QNum) & Str(CNam) & (CrDt) & " Ver" & Str(VNum)
End Sub
The debugger is coming up with a run time error, type mismatch.
Someone PLEASE help!
Thank you in advance.