Create another form using macro?

  • Thread starter Thread starter BrianG
  • Start date Start date
B

BrianG

I've created a Purchase Order form in Excel 97 where the Auto_Open
macro increments a number then saves the workbook to a temporary
location for further data entry. Once all data is entered, a macro
Sub is activated which saves the workbook to a permanent location and
deletes the temporary file. At this point I'd like to offer the user
the opportunity to create a new purchase but logic tells me that I'm
going to run into problems with passing control to the macro of the
new Purchase Order. Here's my thinking: If I close the open file,
the macro ends but if I open the new Purchase Order file, the
Auto_Open macro will take over and I won't get a chance to close the
saved file. Is there a solution?
 
application.OnTime Now,"C:\folder1\Purchase Order File.xls!Auto_Open"
Thisworkbook.close
End Sub

Using OnTime will break the connection. Also, it will open the Purchase
Order File workbook to run the macro. Auto_Open doesn't run normally if a
file is opened programmatically, so calling it explicitly shouldn't cause a
conflict, but test to be sure (naturally).
 
Back
Top