Excel Macro for Save as PDF (to a share point folder)

drefiek2

Board Regular
Joined
Apr 23, 2023
Messages
59
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi,
I am very new to macros and would like to know how I can do the following. I have a single sheet in an excel workbook and I want a button which will:
1.save the sheet (an array of cells) as a PDF (landscape) in a particular work sharepoint folder
2. The pdf file name should be whatever is in cell C3
3. If the save is successful I want a pop up message box to say that. If it is unsuccessful I would like an error message box to say that.


Thank you in advance.
 
One way:
VBA Code:
    Select Case MsgBox("Have you checked the date?", vbYesNo Or vbQuestion, Application.Name)
    Case vbNo
        Debug.Print "User exit"
        Exit Sub
    End Select

Place the code near the start of your macro.

This new question does not have much to do with the original topic of this thread. A thread on Mr Excel has two main purposes. The first is to help the person who created the thread and posted the question (in this case, you). The second is to help other members of the forum that might have a similar problem and are searching for posts that could help them. Changing the topic and asking questions on a different subjects defeats the second purpose, so the better course of action is to create a new thread for new and unrelated questions.
It works, thank you very much and I note your comments.
 
Upvote 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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