W
Wayne-I-M
I need to add “ (one paid of commas) to the start and end of a string in VBA.
I need to create something like
"C:\Documents and Settings\My Documents\123.jpg"
what I am getting is
C:\Documents and Settings\My Documents\123.jpg
Eg. (this does not work)
inbox txtPath would be
C:\Documents and Settings\My Documents\
Private Sub ButtonName _Click()
If Dir(Me.txtPath &[ClientID] & ".jpg")<> "" Then
MsgBox "Some possitive message", vbInformation, "Title"
Else
MsgBox "Some neggative message", vbInformation, "Title"
End If
End Sub
But this does work
Private Sub ButtonName _Click()
If Dir("C:\Documents and Settings\My Documents\123.jpg") <> "" Then
MsgBox "Some possitive message", vbInformation, "Title"
Else
MsgBox "Some neggative message", vbInformation, "Title"
End If
End Sub
And adding the commas to the text box will not work as I need to add the
[ClientID] & ".jpg" after the path section to give the full path to the file.
The reason is that the 2nd code has the path including the proceeding “ and
the ending “.
How do I add the “ (commas) to the start and end of the path section of the
code.
I have tried
If Dir(“â€â€& Me.txtPath & [ClientID] & ".jpg"&â€â€â€)
And
If Dir(“â€â€& Me.txtPath & [ClientID] & ".jpgâ€â€)
Nether work
Any ideas would be really helpful.
I need to create something like
"C:\Documents and Settings\My Documents\123.jpg"
what I am getting is
C:\Documents and Settings\My Documents\123.jpg
Eg. (this does not work)
inbox txtPath would be
C:\Documents and Settings\My Documents\
Private Sub ButtonName _Click()
If Dir(Me.txtPath &[ClientID] & ".jpg")<> "" Then
MsgBox "Some possitive message", vbInformation, "Title"
Else
MsgBox "Some neggative message", vbInformation, "Title"
End If
End Sub
But this does work
Private Sub ButtonName _Click()
If Dir("C:\Documents and Settings\My Documents\123.jpg") <> "" Then
MsgBox "Some possitive message", vbInformation, "Title"
Else
MsgBox "Some neggative message", vbInformation, "Title"
End If
End Sub
And adding the commas to the text box will not work as I need to add the
[ClientID] & ".jpg" after the path section to give the full path to the file.
The reason is that the 2nd code has the path including the proceeding “ and
the ending “.
How do I add the “ (commas) to the start and end of the path section of the
code.
I have tried
If Dir(“â€â€& Me.txtPath & [ClientID] & ".jpg"&â€â€â€)
And
If Dir(“â€â€& Me.txtPath & [ClientID] & ".jpgâ€â€)
Nether work
Any ideas would be really helpful.