Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
|
Lista Forumurilor Pe Tematici
|
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login
POZE MRRRR'S FORUM (VIEW ONLY)
Nu sunteti logat.
|
Nou pe simpatie: Popa Bianca
| Femeie 24 ani Valcea cauta Barbat 25 - 63 ani |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 787
|
|
I've encountered several problems using a simple Workbook_Open subroutine. While it seemed to work fine yesterday in testing, today when I opened Excel I get error that Personal.XLSB is corrupted. I couldn't save it in any way I tried, fortunately I had a backup and the exported modules since the backup. I think I got all back.
Anyway, this is the code that had errors today:
Private Sub Workbook_Open() If ActiveWorkbook.Name = "AAA BBBB CCCC.xlsx" Then Worksheets("Sheet1").Range("G1") = "CLASSIC" End If End Sub |
Here's the code that works fine, apparently, at least so far (after a few tests) - added this in PERSONAL.xlsb, in ThisWorkbook:
Public WithEvents App As Application
Private Sub Workbook_Open() Set App = Application End Sub Private Sub App_WorkbookOpen(ByVal Wb As Workbook) If Wb.Name = "AAA BBBB CCCC.xlsx" Then Wb.Worksheets("Sheet1").Range("G1") = "CLASSIC" End If End Sub
|
Source:
|
|
pus acum 1 an |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 787
|
|
The 2nd code above still works fine today.
So it passed the test.
|
|
pus acum 11 luni |
|