VBA remove "/" character from variable

Posted on 2006-05-24
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 95

    Accepted Solution

    Use Replace()

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

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

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

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
    Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
    This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
    This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now