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

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,224,890
Messages
6,181,612
Members
453,057
Latest member
LE102024

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