Userform with path to sharepoint and copy pdf file to my folder

LukSwi335

New Member
Joined
Mar 6, 2023
Messages
1
Office Version
  1. 2021
Platform
  1. Windows
Hello,

I've got an issue with FIleCopy command in VBA. I always used this when i wanted to copy/paste some file from one folder to another. (but it was local or based on the server).
Unfortunately at that moment i have to wokr with onedrive solution. I need to build some file (or rather wanna to add simple ribbon button*xlam to my colleagues), which will show simple userform with some textxbox to fill in and "attache" PDF file as well which should be saved in my folder (which of course is shared for others). In userform i added command button to indicate which file should be attached (user should choose one PDF file e.g invoice). Then this macro should copy this file and paste it to the folder shared by me.
path to my folder will be:
https:\\19retail-my.sharepoint.com\personal\luk_swi\Documents\Desktop\Invoices
Unfortunately FileCopy doesnt work (or i do something wrong) if paths are connected to onedrive/sharepoint.

I tried as well to first open this indicated file (ActiveWorkbook.FollowHyperlink PDF_path) and its working correct but then i cannot save this "opened" pdf to my : https:\\19retail-my.sharepoint.com\personal\luk_swi\Documents\Desktop\Invoices

Please help



Private Sub CommandButton1_Click()
Dim result As Variant

result = Application.GetOpenFilename("PDF Files (*.pdf), *.pdf")

If result <> False Then
FileTextBox.Text = result
End If

End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,214,950
Messages
6,122,436
Members
449,083
Latest member
Ava19

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