I'm trying to use an environment variable ( %userName%) so when the user of the spreadsheet saves the macro, it directs it to the folder's that were created with a batch file (md "%userprofile%\desktop\XXXXX) I can get it to save to a specific file but I'm not having any luck using the variable. Any Ideas?
Sub RDB_Worksheet_Or_Worksheets_To_PDF_And_Create_Mail()
Dim FileName As String
FolderName = Environ("UserName")
Dim Today As Date
Today = Date
If ActiveWindow.SelectedSheets.Count > 1 Then
MsgBox "There is more then one sheet selected," & vbNewLine & _
"be aware that every selected sheet will be published"
End If
code(sheet not have to be active then)
FileName = RDB_Create_PDF(ActiveSheet, "c:\documents and settings\%username%\Desktop\Time_Sheets\" & Range("b35") & ".pdf", True, False)
Sub RDB_Worksheet_Or_Worksheets_To_PDF_And_Create_Mail()
Dim FileName As String
FolderName = Environ("UserName")
Dim Today As Date
Today = Date
If ActiveWindow.SelectedSheets.Count > 1 Then
MsgBox "There is more then one sheet selected," & vbNewLine & _
"be aware that every selected sheet will be published"
End If
code(sheet not have to be active then)
FileName = RDB_Create_PDF(ActiveSheet, "c:\documents and settings\%username%\Desktop\Time_Sheets\" & Range("b35") & ".pdf", True, False)