Invoice Printing & Saving

gumgeen

New Member
Joined
Dec 1, 2004
Messages
17
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
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
step through your code <F8> and see where it fails.
 
Upvote 0

Forum statistics

Threads
1,214,559
Messages
6,120,208
Members
448,951
Latest member
jennlynn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top