ExcelRookie01
New Member
- Joined
- Mar 18, 2025
- Messages
- 4
- Office Version
- 365
- 2016
- Platform
- Windows
Hi there.
I need to make a function for exporting a file as an PDF and attach it to an e-mail. I have the vba working for me, by inserting my username (U18695) in the FilePath.
However I need the function to work for multiple users, so I was wondering if it is possible to have an inputbox show up when running the macro, where the user can type in their username and then have the variable username inserted into the filepath in the code???
I have inserted the first part of the code below. Please let me know if you would need the whole code to help me out
Thanks!!
CODE:
Sub SendBelæg_PO()
Dim OutApp As Object
Dim OutMail As Object
Dim Filepath As String
Dim Filename As String
'Set the file path and name for the PDF file
Filepath = "C:\Users\U18695\Documents\"
Filename = ActiveWorkbook.Name & ".pdf"
I need to make a function for exporting a file as an PDF and attach it to an e-mail. I have the vba working for me, by inserting my username (U18695) in the FilePath.
However I need the function to work for multiple users, so I was wondering if it is possible to have an inputbox show up when running the macro, where the user can type in their username and then have the variable username inserted into the filepath in the code???
I have inserted the first part of the code below. Please let me know if you would need the whole code to help me out

Thanks!!
CODE:
Sub SendBelæg_PO()
Dim OutApp As Object
Dim OutMail As Object
Dim Filepath As String
Dim Filename As String
'Set the file path and name for the PDF file
Filepath = "C:\Users\U18695\Documents\"
Filename = ActiveWorkbook.Name & ".pdf"