Hi, I don't know anything about vba so i need some help here. I got this code:
Private Sub GemSom_Click()
MkDir "C:\Users\Martin\\\\\\\TEST" & Range("b6").Value & " " & Date
Dim Path As String
Dim FileName As String
FileName = Range("b6").Value & " " & Date
ActiveWorkbook.SaveAs "C:\Users\\\\\\\\\TEST" & Range("b6").Value & " " & Date & "" & FileName & ".xlsm"
ActiveSheet.Shapes("GemSom").Delete
End Sub
and it's working but; i do not want it in this folder. I need the new folde in the same folder as the workbook (ActiveWorkbook.Path or somthing like this) but I can't make it work.
Next i use this code for creating a PDF but it seem to complicated in my eys:
Private Sub CommandButton1_Click()
Dim i As Long, StrPath As String, StrFlNm As String, ArrNames
ArrNames = Array("Koebekontrakt")
StrPath = ActiveWorkbook.Path & ""
For i = 0 To UBound(ArrNames)
With Sheets(ArrNames(i))
StrFlNm = ArrNames(i) & Format(.Range("H7"), " mmmm yyyy")
.ExportAsFixedFormat Type:=xlTypePDF, FileName:=StrPath & StrFlNm, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
Next
End Sub
I need the PDF in the same folder as the workbook, but named as the "worksheedname & workbookname & date"
It's probably simpel but i cant find the code i need anywere, so if anyone can help I whould be greatfull
Private Sub GemSom_Click()
MkDir "C:\Users\Martin\\\\\\\TEST" & Range("b6").Value & " " & Date
Dim Path As String
Dim FileName As String
FileName = Range("b6").Value & " " & Date
ActiveWorkbook.SaveAs "C:\Users\\\\\\\\\TEST" & Range("b6").Value & " " & Date & "" & FileName & ".xlsm"
ActiveSheet.Shapes("GemSom").Delete
End Sub
and it's working but; i do not want it in this folder. I need the new folde in the same folder as the workbook (ActiveWorkbook.Path or somthing like this) but I can't make it work.
Next i use this code for creating a PDF but it seem to complicated in my eys:
Private Sub CommandButton1_Click()
Dim i As Long, StrPath As String, StrFlNm As String, ArrNames
ArrNames = Array("Koebekontrakt")
StrPath = ActiveWorkbook.Path & ""
For i = 0 To UBound(ArrNames)
With Sheets(ArrNames(i))
StrFlNm = ArrNames(i) & Format(.Range("H7"), " mmmm yyyy")
.ExportAsFixedFormat Type:=xlTypePDF, FileName:=StrPath & StrFlNm, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
Next
End Sub
I need the PDF in the same folder as the workbook, but named as the "worksheedname & workbookname & date"
It's probably simpel but i cant find the code i need anywere, so if anyone can help I whould be greatfull