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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

diddi

Well-known Member
Joined
May 20, 2004
Messages
3,337
Office Version
  1. 2010
Platform
  1. Windows
step through your code <F8> and see where it fails.
 
Upvote 0

Forum statistics

Threads
1,191,691
Messages
5,988,111
Members
440,126
Latest member
duque00

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
Top