Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5969227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:12:00+00:00 2026-05-22T20:12:00+00:00

What am I doing wrong here? If FilePath.ToLower().Contains(.pdf) Then Dim Replaced As String =

  • 0

What am I doing wrong here?

If FilePath.ToLower().Contains(".pdf") Then
    Dim Replaced As String = FilePath.Replace("\","/")
    FilePath = "http:" & Replaced
End If 

If FilePath is for example \\sharepoint\file.pdf, the expected output should be http://sharepoint/file.pdf. However, the actual output is http:\\sharepoint\file.pdf

Update 1

This is the original string:
original string

This is what it looks like after my VB code:
replaced string

As you can see, the http: part is added, however the backslashes haven’t been touched.

Update 2
It has something to do with the slashes. Because when I replace other characters (for example a with @), then the replaced string is shown correctly. But not the slashes

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:12:01+00:00Added an answer on May 22, 2026 at 8:12 pm

    I still don’t exactly understand why, but the following has fixed my code:

    Dim Replaced As String = FilePath
    If FilePath.ToLower().Contains(".pdf") Then
        Replaced = FilePath.Replace("\","/")
        Replaced = "http:" & Replaced
    End If 
    

    and then in the vbscript code I use

    Sub toonDocument()
    dim spobject
    set spobject = CreateObject("Sharepoint.Document")
    spobject.FilePath = "<% = Replaced %>"
    spobject.openen()
    set spobject = nothing
    

    so <% = Replaced %> (instead of <%= FilePath %>)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What am I doing wrong here? My use of the INTO clause seems to
I can't seem to figure out what I am doing wrong here. I publish
I'm not sure what exactly i'm doing wrong here...but i noticed that my File.Move()
What am I doing wrong here ? /* * Consider the following pseudo code
What am I doing wrong here?: <GridViewColumn> <GridViewColumn.CellTemplate> <DataTemplate> <Button> <Button.ToolTip> <TextBlock Text={Binding Path=Title,
I'm not sure what I'm doing wrong here, I have a file in lib/acts_as_votable.rb
I don't know what I'm doing wrong here. I have a ListBox whose DataContext
I'm not sure what I am doing wrong here, not even sure if I
Not sure what I'm doing wrong here, I just want to be able to
can someone kindly suggest what I'm doing wrong here? I'm trying to get the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.