strangedenial
New Member
- Joined
- Sep 15, 2014
- Messages
- 39
My Bad !!!!!!!!!
The code did not work because The File location is was changed !!!
I leave the code for the ones who would use it if needed!
Sorry again !
The code did not work because The File location is was changed !!!
I leave the code for the ones who would use it if needed!
Sorry again !
Code:
Sub NextInvoice()
Range("F4").Value = Range("F4").Value + 1
Range("F5").ClearContents
End Sub
Sub Excel_to_Word()
Dim wrdApp As Object
Dim wrdDoc As Object
Dim i As Integer
Dim fName As String
Dim fLoc As String
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Add("C:\Users\ozgur\Documents\FINANS\test.docx")
With ActiveSheet
.Range(.Range("A1:F27"), .Cells(.Rows.Count, 1).End(xlUp)).Copy
End With
fName = ActiveSheet.Range("F5").Value & "." & ActiveSheet.Range("B10").Value & "." & ActiveSheet.Range("F3").Value & "." & ActiveSheet.Range("F4").Value & ".docx"
fLoc = "C:\Users\ozgur\Documents\FINANS\Odemeler\"
wrdApp.Documents.Add.Content.Paste
Application.CutCopyMode = False
wrdApp.ActiveDocument.Saveas Filename:=fLoc & fName
wrdApp.Application.Quit
Dim myPath1 As String
myPath1 = "C:\Users\ozgur\Documents\FINANS\Odemeler\"
If ActiveSheet.Range("D6").Value = "" Then
ActiveSheet.Copy
With ActiveWorkbook
.Saveas myPath1 & ActiveSheet.Range("F5").Value & "." & ActiveSheet.Range("B10").Value & "." & ActiveSheet.Range("F3").Value & "." & ActiveSheet.Range("F4").Value & ".xlsx"
.Close
NextInvoice
End With
End If
End Sub
Last edited: