I am using following codes in excel 2003 for my invoice printing and saving, its always works properly, but I just change my office prog. from office 2003 to office 2007, now the code is not properly working, It is not saving it says, error while saving the invoice.
Can anybody help me,? Just it should work both in office 2003 and office 2007. Thanks:
I am using this codes:
Private Sub CommandButton1_Click()
Dim malik As String
Dim dato As String
malik = Sheets("Faknr").Range("A1")
dato = Sheets("Faknr").Range("A3")
Range("c15") = malik
Range("j16") = dato
Mark = Array("", "Copy", "File", "Bogføring")
For i = 1 To 4
Range("F15") = Mark(i - 1)
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=False, Collate:=True
Next i
Dim NewFilePath As String
Dim InvoiceNumber As String
NewFilePath = "I:/Faktura/2009/Faktura"
InvoiceNumber = Sheets("Faknr").Range("A1")
ActiveWorkbook.Save
ActiveSheet.Copy
ActiveSheet.Shapes("CommandButton1").Select
Selection.Delete
ActiveSheet.Shapes("Billede 2").Select
Selection.Delete
ActiveWorkbook.SaveAs NewFilePath & "" & InvoiceNumber & ".xls"
MsgBox "Invoice Number " & InvoiceNumber & _
" saved as: " & NewFilePath & "" & InvoiceNumber & ".xls"
ActiveWorkbook.Close
Range("c15") = "=Faknr!A1"
Range("j16") = "=Faknr!A3"
Sheets("Faknr").Range("A1").Value = Sheets("Faknr").Range("A1").Value + 1
Sheets("Faknr").Select
End Sub
Can anybody help me,? Just it should work both in office 2003 and office 2007. Thanks:
I am using this codes:
Private Sub CommandButton1_Click()
Dim malik As String
Dim dato As String
malik = Sheets("Faknr").Range("A1")
dato = Sheets("Faknr").Range("A3")
Range("c15") = malik
Range("j16") = dato
Mark = Array("", "Copy", "File", "Bogføring")
For i = 1 To 4
Range("F15") = Mark(i - 1)
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=False, Collate:=True
Next i
Dim NewFilePath As String
Dim InvoiceNumber As String
NewFilePath = "I:/Faktura/2009/Faktura"
InvoiceNumber = Sheets("Faknr").Range("A1")
ActiveWorkbook.Save
ActiveSheet.Copy
ActiveSheet.Shapes("CommandButton1").Select
Selection.Delete
ActiveSheet.Shapes("Billede 2").Select
Selection.Delete
ActiveWorkbook.SaveAs NewFilePath & "" & InvoiceNumber & ".xls"
MsgBox "Invoice Number " & InvoiceNumber & _
" saved as: " & NewFilePath & "" & InvoiceNumber & ".xls"
ActiveWorkbook.Close
Range("c15") = "=Faknr!A1"
Range("j16") = "=Faknr!A3"
Sheets("Faknr").Range("A1").Value = Sheets("Faknr").Range("A1").Value + 1
Sheets("Faknr").Select
End Sub