B
BrianG
I've created a purchase order form in which I automate the filename
creation on save. I create the filename by appending the sequentially
created "purchase order" number with the first 5 characters of the
vendor name. I've run into a problem with vendor names which contain a
slash (/) character, an invalid character in a filename. Does anyone
have any suggestions on a workaround?
Here is the pertinent snippet of my code:
==============
'***************** Assign values to variables ************************
strVendName = Range("E9") 'Assign vendor name (from cell E9)
strPONum = Range("AA2") 'Assign PO number (from cell AA2)
intNumLength = Len(strPONum) 'Assign length of the PO number
strShortVendName = Left(strVendName, 5) 'Assign 1st 5 char of vendor
name
strDestFileName = strPONum & "_" & strShortVendName & ".xls"
'*********************************************************************
Application.EnableEvents = False
ActiveWorkbook.SaveAs filename:=strDestPath & strDestFileName,
FileFormat:=xlNormal
===============
Note: The variable strDestPath is previously assigned a value of
"p:\users\to_share\purchase orders\"
TIA
BrianG
creation on save. I create the filename by appending the sequentially
created "purchase order" number with the first 5 characters of the
vendor name. I've run into a problem with vendor names which contain a
slash (/) character, an invalid character in a filename. Does anyone
have any suggestions on a workaround?
Here is the pertinent snippet of my code:
==============
'***************** Assign values to variables ************************
strVendName = Range("E9") 'Assign vendor name (from cell E9)
strPONum = Range("AA2") 'Assign PO number (from cell AA2)
intNumLength = Len(strPONum) 'Assign length of the PO number
strShortVendName = Left(strVendName, 5) 'Assign 1st 5 char of vendor
name
strDestFileName = strPONum & "_" & strShortVendName & ".xls"
'*********************************************************************
Application.EnableEvents = False
ActiveWorkbook.SaveAs filename:=strDestPath & strDestFileName,
FileFormat:=xlNormal
===============
Note: The variable strDestPath is previously assigned a value of
"p:\users\to_share\purchase orders\"
TIA
BrianG