0 votes
in VBA by Beginner (5 points)

Hello - first time, with a very simple question: I want to open a workbook, change something, and close it automatically, without a message. That looks something like this:

Private Sub Workbook_Open()
    Tabelle1.Range("A1").Value = "Test"
                        ' here doing other jobs (don't ask)
    Application.Quit
End Sub

Please how can this work without a message? 

Thank you, frank.

1 Answer

0 votes
by Skilled (328 points)
selected by
 
Best answer

Try this:

Private Sub Workbook_Open()
    Tabelle1.Range("A1").Value = "Test"
                        ' here doing other jobs (don't ask)
    ThisWorkbook.Save
    Application.Quit
End Sub

See https://docs.microsoft.com/en-us/office/vba/api/excel.application.quit

by Beginner (5 points)
ThisWorkbook.Save

Yes - That's exactly what I wanted! Thank you

Welcome to wellsr Q&A
wellsr Q&A is the VBA and Python programming community that rewards you for learning how to code.

Getting Started
Register
VBA Cheat Sheets (On Sale Now)

Earn free prizes for asking VBA and Python questions and for answering questions asked by others in our community.

What makes us different?
Our points system rewards you with a chance for free gifts based on the quality of your questions and answers. All you have to do is post and you could get rewarded, like these members:

Hightree $10 Amazon Gift Card
Thales1 $10 Amazon Gift Card
runfunke $10 Amazon Gift Card
coolag $10 Amazon Gift Card
Siew Hun $10 Amazon Gift Card

So, why don't you join us? It really is an encouraging way to motivate members in our VBA and Python community.

Register

For more programming tips visit the VBA Tutorials Blog and the Python Tutorials Blog.

...