Rushikkumar Patel
asked on
Macro Path finder is not working for another user
My question is:
I have this path finder code in my macro which is:
LocalAddress = Application.ThisWorkbook.F ullName
It is working fine for getting my file but when i pass this code to my team member who works from different computer and drive, it is not working for him.
Please help in this code line so that it can work with any computer.
thank you so much in advance.
I have this path finder code in my macro which is:
LocalAddress = Application.ThisWorkbook.F
It is working fine for getting my file but when i pass this code to my team member who works from different computer and drive, it is not working for him.
Please help in this code line so that it can work with any computer.
thank you so much in advance.
ASKER
Tes. It is defined as string.
When other user use this code he got the error 76, path could not found.
When other user use this code he got the error 76, path could not found.
ASKER
*yes
It must be something else that is the cause of the error, because that's standard code and as I said it works for me and I'm definitely on a different computer and drive from you:). Please post the whole macro.
ASKER
Dim SharepointAddress As String
Dim LocalAddress As String
Dim objNet As Object
Dim FS As Object
SharepointAddress = "\\mysite.sharepoint.com\s ites\xyz-u at\a1docsu at" & "\" ' Where you will enter your location path
LocalAddress = "your file path" ' Where you will enter the file path, ex: Excel file
Set objNet = CreateObject("WScript.Netw ork")
Set FS = CreateObject("Scripting.Fi leSystemOb ject")
If FS.FileExists(LocalAddress ) Then
FS.CopyFile LocalAddress, SharepointAddress
End If
Set objNet = Nothing
Set FS = Nothing
I have used this code from this site.
Dim LocalAddress As String
Dim objNet As Object
Dim FS As Object
SharepointAddress = "\\mysite.sharepoint.com\s
LocalAddress = "your file path" ' Where you will enter the file path, ex: Excel file
Set objNet = CreateObject("WScript.Netw
Set FS = CreateObject("Scripting.Fi
If FS.FileExists(LocalAddress
FS.CopyFile LocalAddress, SharepointAddress
End If
Set objNet = Nothing
Set FS = Nothing
I have used this code from this site.
If you want LocalAddress to contain just the address then do this
LocalAddress = Application.Path
If you want path and file name (which I think you do) then do this.
LocalAddress = Application.Path & "\" & Application.ThisWorkbook.F ullName
LocalAddress = Application.Path
If you want path and file name (which I think you do) then do this.
LocalAddress = Application.Path & "\" & Application.ThisWorkbook.F
ASKER
I will check this again on my work.
But why it works on mine computer and not for other user?
Thanks.
But why it works on mine computer and not for other user?
Thanks.
I don't know.
Application.ThisWorkbook.F ullName will return a valid file path only if the file is saved. Are you sure that the user saved the file before testing the code?
ASKER
I will check it tomorrow.
Thank you.
Thank you.
Neeraj is correct.
ASKER
I have excel 2010 and other user have excel 2016. Does it affect anyway in not running the code on 2016 excel?
ASKER
The file was saved. Still it is not working for other user.
Any other area i might need to look for the problems? Is it something to do with sharepoint access?
thanks.
Any other area i might need to look for the problems? Is it something to do with sharepoint access?
thanks.
What do you mean by "not working"?
ASKER
User got Run time error: 76 Path not found.
Have the user do this:
1) Add the following line of code just before the LocalAddress = Application.ThisWorkbook.F ullName line
2) Debug.Print LocalAddress = Application.ThisWorkbook.F ullName
3) Run the macro
4) Go to Visual Basic via Alt+F11
5) Go to the Immediate Window vis Ctrl+G
6) Tell us what is in the Immediate Window
1) Add the following line of code just before the LocalAddress = Application.ThisWorkbook.F
2) Debug.Print LocalAddress = Application.ThisWorkbook.F
3) Run the macro
4) Go to Visual Basic via Alt+F11
5) Go to the Immediate Window vis Ctrl+G
6) Tell us what is in the Immediate Window
ASKER
Other use have to enter their Sharepoint site credential manually every time they go use Connect and export option while I do not have to.
Does it affect his macro because of not allowing the access through that credential part?
Thank you.
Also i have asked user to do above steps. Once i will get the reply i will post it.
Does it affect his macro because of not allowing the access through that credential part?
Thank you.
Also i have asked user to do above steps. Once i will get the reply i will post it.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
It is deigned to return the workbook name and it does in my workbook.
Please describe what you mean by "it is not working for him".