[Help] With VBA code wanna save a workbook automatic and open it

Drumaster

New Member
Joined
Feb 28, 2011
Messages
25
Hi all,

I write a VBA code to automatically open an Excel file.
but the way i didt doenst work (see my code).

does someone has an idea how I can deal with this.

And another question: Now I save my file as data.xls it is also possible to save it whit the date of that day??

example data21/11/11.xls or something in that way.

thanks in advance

ps. sorry for my english not that good in writing :s

Sheets("AlarmTop10").Select
ActiveWorkbook.SaveCopyAs "C:\TEMP\Data.xls"
Workbooks("Alarmlog.dbf").Close SaveChanges:=False
Workbooks.Open "C:\TEMP\Data.xls"
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Why do you want to close it and reopen it again straight after?

The reason the above doesn't work is because you have already closed your workbook and therefore stopped the macro.
 
Upvote 0
i also swap the lines but that still didnt work. why i wanna do this is becaus when they open the Alarmlog.dbf file i dont want the change something in that file. that is why i copysave it to date.xls file and there they can do what they want.
 
Upvote 0
Why do you want to close it and reopen it again straight after?

The reason the above doesn't work is because you have already closed your workbook and therefore stopped the macro.

Thanks for the advice

Do also know how to save with date
 
Upvote 0
Hi,

You can try:

Code:
ActiveWorkbook.SaveCopyAs "C:\TEMP\Data " & Day(Date) & "-" & Month(Date) & "-" & Year(Date) & ".xls"
 
Upvote 0

Forum statistics

Threads
1,224,502
Messages
6,179,126
Members
452,890
Latest member
Nikhil Ramesh

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