Trouble saving multiple Excel documents- Please Help

Ptech
05-15-2008, 01:36 PM
Hello

I have this program that I collect data for service call and when I'm done. I save files as .xls but separate the reports from the invoice. On this specific page. I click "Save" to save the report and another button to save invoice. They will not work one after another, either or but not after each other. I know it's has to be a simple mistake but I'm stumped. Here's the code.

Private Sub InvoiceSave_Click()

Do
Sheets(Array("Invoice")).Copy

fname = Application.GetSaveAsFilename(Range("AX2").Text + " " _
+ Range("F12").Text + " " + Range("AL13").Text + " " _
+ Format(Range("AX1").Text, "yymmdd") + " Invoice", "Excel Files (*.xls), *.xls,All Files (*.*),*.*")
Loop Until fname <> ""
ActiveWorkbook.SaveAs fname

End Sub

Private Sub SaveReport_Click()

Do
Sheets(Array("Maintenance Data Sheet", "Field Activity Report", "Extended Note")).Copy
fname = Application.GetSaveAsFilename(Range("AX2").Text + " " _
+ Range("F12").Text + " " + Range("AL13").Text + " " _
+ Format(Range("AX1").Text, "yymmdd"), "Excel Files (*.xls), *.xls,All Files (*.*),*.*")
Loop Until fname <> ""
ActiveWorkbook.SaveAs fname

End Sub




Please post Excel questions, in the Excel forum.

Please use the .. tags when you post your code. Edit or reply to this post to see how.

Thank you.

Colin Legg
05-16-2008, 01:42 AM
Hello
They will not work one after another, either or but not after each other. I know it's has to be a simple mistake but I'm stumped. Here's the code.


Hello Ptech and welcom to XVBT! :)

Please be sure to read the posting guidelines (http://www.xtremevbtalk.com/faq.php?faq=evbf_faq#faq_evbf_rules).

When you say that it doesn't work... what do you mean? Do you mean the file doesn't appear to save.... or perhaps you get a run-time error? If you do get an error what is the error message and which line causes the error? Specific details please.....

Colin


Cross-posted here: http://www.vbforums.com/showthread.php?t=522999

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum