VBA remove "/" character from variable

Posted on 2006-05-24
Medium Priority
Last Modified: 2012-06-27
We use VBA to save as filename from the text in the document. Sometimes there is a "/" in the text that we want to replace (so it won't create an error by appearing to place a path character in a filename. How would we replace this character in a variable?

Will increase/split points for all helpful comments---thanks!
Question by:esc_toe_account
1 Comment
LVL 97

Accepted Solution

Lee W, MVP earned 900 total points
ID: 16753955
Use Replace()

variable = REPLACE(variable, "/", "-")

I assumed a dash would suffice, to simply remove it, use:

variable = REPLACE(variable, "/", "")

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question