Using a single quote in VBA. The Single quote is a part of the pathname of a Sharepoint folder.

MarcBergmans

New Member
Joined
Nov 2, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm asked to change an existing VBA Macro.
The macro store pathnames in variable and then in a loop the cells of the excel sheets in the variable are filled.
In the pathname there is a ' (single quote). Example \2021 Q3 A&S\10. QRT's.
It a file on a Sharepoint-site.
When i removed the ' in the string and make a directory with the name 10. QRTs, the macro works.
A possibility is changing the name of the folder, but i'm not authorized to do this, so a method to use ' in a string would be a good solution.
I searched on the internet but the proposals I found doesn't work.
I tried to put the ' between Double quotes, to put the quote between parenthesis(), to concatenate the ' with other characters in a new other variable and using this variable in the folder name.
But until now I didn't find a method that works.
I work with O365.
Do someone knows a solution

Thank you in advance

My best regards,
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Welcome to the forum. :)

How is your code actually using the paths? If it's in a formula, you need to double the quote in your code - i.e. store it using something like Replace$(thePath, "'", "''")
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top