I am trying to save a range from a sheet as PDF through VBA. Following is the code that I have written.
The weird thing is that it is working fine on one system and I able to save it at the mentioned path and then also send out a mail, but while testing it on another system I am getting the error as 'Error while printing'. Completely clueless. Can anyone help??
Nov 3, 2016 - Encrypt System Data. From the Apple menu, select System Preferences. Go to the Security & Privacy pane. Select the FileVault tab. Click the lock to make changes and click the 'Turn On FileVault.' As the warning states, store this key in a safe place. Restart your Mac and the encryption process will begin.
Kamlesh KishorKamlesh Kishor
2 Answers
In Mac Office 2016 Microsoft have to deal with Apple’s sandbox requirements due to which VBA needs permission to access folders and this is not prompted while trying to save via VBA instead it gives an error. But there are a few places on Mac that one can use to let the code do what it needs to do without user interaction.
one such path is /Users/username/Library/Group Containers/UBF8T346G9.OfficeThis folder gets created when Office 2016 is installed.
So I saved the PDF to this folder, moved it to the desired location and it is working fine now.
For more details and the code go through http://www.rondebruin.nl/mac/mac034.htm
Kamlesh KishorKamlesh Kishor
Make sure that Excel SaveAsPDFandXPS addin is installed, if available for Mac then you should be able to find it on Microsoft site,it available for free. Install it then the code should work just fine.
user85489user85489
Not the answer you're looking for? Browse other questions tagged excelmacosvbaexcel-vbaexcel-vba-mac or ask your own question.
If you use a computer, you probably have some Microsoft Excel documents on your Mac or PC that you wouldn’t want other people to find and read.
After all, Excel is used by the average person, businesses, government institutions, and millions of other folks all over the world. Whether you’re creating graphs, converting PDFs, or just inputting rows and rows of data, the best way to keep that information safe is to learn how to password protect an Excel file.
Adding a password
Step 1: In Excel, open the document you want to secure with a password.
Step 2: Click File, followed by Info.
Step 3: Next, click the Protect Workbook button. From the drop-down menu, select Encrypt with Password.
Step 4: Excel will then prompt you to type in a password. Pick one that’s complicated and unique and note it down in your password manager.
It is paramount that you remember it, or have access to a copy of it in a secure location, because if you forget it, you will lose access to the Excel file and recovering it will be very difficult.
From now on, any time you try to open that file, Excel will prompt you to input your newly chosen password.
Note: This password only protects that individual document, not every Excel document on your PC. If you want all Excel files to have similar protection, you’ll need to password protect each file individually, or look at more advanced protections.
If you want to see whether an Excel file has password protection or not, check out the Info tab for the document and look at the Protect Workbook section. It will tell you whether a password is required to open it or not.
Now that you’ve password protected your most important files, it might be worth considering adding extra layers of security to your system. The easiest way to protect a large number of files is to encrypt them. Luckily, encryption programs are not hard to find. Windows 10 Professional users have a built-in encryption utility called Bitlocker, but if you want to download a free version with lots of customization options for many types of data, you can try Crypto Expert 8 or VeraCrypt open source downloads.
Additional security options
Excel also allows you to apply more customized security options to your file if necessary. It’s important to know what these other options do so you can create the right security for your project. Under Protect Document, you’ll find several additional features that may prove useful:
![For For](http://securityspread.com/wp-con7ent2/uploads/2016/10/Sierra-FileVault-1.png)
Mark as Final: This will mark the file as completed, which lets other people know that they shouldn’t make any changes. This will not secure the file behind a password, however, so it doesn’t really offer any security.
Protect Current Sheet: This will guard the currently selected worksheet with a password so that people can’t make any changes. It’s a handy option if there’s only one sheet in the workbook that you want to protect, and you don’t mind if people can see the info — you just don’t want them messing with anything. You will notice that there’s also an option to do this with “Workbook Structure,” which protects data throughout the workbook from changes unless people have the password.
Restrict Access: This is an interesting option used by organizations where IT has created security templates that essentially lock Excel files to only certain people or ranks. It’s handy in larger organizations where some people should be able to access the file, but not everyone.
Add a Digital Signature: This simply verifies the file as the real version, which is useful when sending it to other people or organizations, and to make sure it hasn’t been altered. It also helps files from being spied on when you send them digitally.
Want to learn more? Here’s our crash course guide to encryption, and another on how to get started with hiding files in Windows 10.