Всем привет.
И снова прошу прошу помощи
Хочу научить сохранять файл с именем в формате неделя - день недели, получилось только научить сохранять номер недели.
То есть необходимо, чтобы было в следующем виде: W08-2, W14-3 и т.п. 1 - пн, 2 - вт, 3 - чт. и так далее. Подскажите, пожалуйста, это возможно?
И снова прошу прошу помощи
Код |
---|
Sub PDFActiveSheet() Dim wsA As Worksheet Dim wbA As Workbook Dim strTime As String Dim strName As String Dim strPath As String Dim strFile As String Dim strPathFile As String Dim myFile As Variant On Error GoTo errHandler Set wbA = ActiveWorkbook Set wsA = ActiveSheet strTime = Format(Now(), "dd.mm.yyyy\_hh.mm") wbA.Save 'get active workbook folder, if saved strPath = wbA.Path If strPath = "" Then strPath = Application.DefaultFilePath End If strPath = strPath & "\" 'replace spaces and periods in sheet name strName = DatePart("WW", Now, vbMonday) 'create default name for savng file strFile = strName & "_" & strTime & ".pdf" strPathFile = strPath & strFile 'use can enter name and ' select folder for file myFile = Application.GetSaveAsFilename _ (InitialFileName:=strPathFile, _ FileFilter:="PDF-????? (*.pdf), *.pdf", _ Title:="????? ????? ? ????? ?????") 'export to PDF if a folder was selected If myFile <> "False" Then wbA.PrintOut ActivePrinter:="Microsoft Print to PDF", PrintToFile:=True, PrToFileName:=strFile 'confirmation message with file info MsgBox "PDF-????? ??????: " _ & vbCrLf _ & myFile End If exitHandler: Exit Sub errHandler: MsgBox "?? ??????? ??????? PDF-?????" Resume exitHandler End Sub |
Хочу научить сохранять файл с именем в формате неделя - день недели, получилось только научить сохранять номер недели.
То есть необходимо, чтобы было в следующем виде: W08-2, W14-3 и т.п. 1 - пн, 2 - вт, 3 - чт. и так далее. Подскажите, пожалуйста, это возможно?