-
1 Attachment(s)
I believe it's a bug in Excel. - Because, If it's more than an unexplicable bug, then why can't I add a page to the attached simplified workbook
(this code behind the command button crashes Excel)
[vba]
Option Explicit
Private Sub CommandButton1_Click()
Dim newPage ' As Page
Set newPage = Me.MultiPage1.Pages.Add
End Sub
[/vba]
But if you change the code: MultiPage1 to MultiPage2, it works fine
[vba]
Option Explicit
Private Sub CommandButton1_Click()
Dim newPage ' As Page
Set newPage = Me.MultiPage2.Pages.Add
End Sub
[/vba]
The Mutlti page controls are both new and the same, so why should I be able to add a new page to MultiPage2, but not MultiPage1
I'd almost be willing to bet that if I place them all in a Frame, it will work.
Why? Needs to just stay another mystery in life.(in my opinion)
-
1 Attachment(s)
As I thought,
From my last post, I placed the 2 MultiPages and the Single command button inside a Frame and bingo, works fine.
At least that demonstrates that it's not your surrounding code.
See attachment.
2 plain MutltiPage controls without any code
and one command button, with only the one command for adding a page.
Edit: Very strange indeed. After adding the Frame and succesfully running the code. Then I tried copy pasting the controls to the clipboard and deleting the Frame and pasting the controls back. -That works in the small example workbook, but not BigJC's file
-
Thanks frank_m you saved me alot of frustration.
So from another persons view is my coding well structured (or at least OK) and correct. Or have i done alot of things the hard way? (because i dont know many excel functions so i wasn't sure if i could optimize in anyway)
-
Hi BigJC,
My pleasure to have been of help.
Unfortunately I'm the wrong person to ask about that, as my programming skills are not so great.
--my skill set is more with my patience and perseverance with puzzle solving using a combination of tinkering and googling. ..
Try starting a new Thread to ask to have one of the Experts look over your routines for any obvious flaws, but for the most part it is expected that you have only one or two specific question's per thread..
Sorry that I can't be me helpful than that. -