noboffinme
Registered User.
- Local time
- Today, 15:48
- Joined
- Nov 28, 2007
- Messages
- 288
Hi
While I write a Sub Routine, I often use some of the possible methods/properties that pop up after you add the Period (or Full Stop). This seems fine until I go to run the code & find I sometimes get errors.
What is the point of these options popping up if they’re incorrect??
I also don’t follow how the object Browser works for the same reason, & if this means I can't use the Object Browser or the pop up options to assist with writing code, what other more reliable sources are there?
I thought if the suggestion that came up as suggested by the Object Browser it should work when run, what am I missing here?
Example;
I start to write some lines of code to open a new blank Powerpoint Presentation as follows;
Option Explicit
Sub ppt_open()
‘Declare application & presentation
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Set PPApp = New PowerPoint.Application
‘Open the Powerpoint application
PPApp.Visible = True
‘The next action I want is to open a new blank Powerpoint Presentation, so I use 'the inbuilt options I’m provided each time I add a period after I select an option & 'I can write the below;
Set PPPres = PPApp.Presentations.Open
When I go to run this line, I get a compile error “Argument not Optional”
So firstly, I thought the error may be that I also get prompted for more options if I add a period, so I should select options until no more options appear.
So, adding to the “Set PPPres = PPApp.Presentations.Open” line until I don’t get prompted anymore, I ended up with the below ‘best assumption’ of the options supplied to open a new blank presentation.
Set PPPres = Presentations.Open.SlideShowWindow.Activate
Predictably, it errors for the same reason.
Is the lesson here that I should know after the “Set PPPres = PPApp.Presentations.Open” causes an error that I’m going down the wrong path & should choose another option after “Set PPPres = PPApp.Presentations…….”?
Any tips or links on how to use the inbuilt functions of the Visual Basic editor or the Object Browser would be appreciated, Thanks
While I write a Sub Routine, I often use some of the possible methods/properties that pop up after you add the Period (or Full Stop). This seems fine until I go to run the code & find I sometimes get errors.
What is the point of these options popping up if they’re incorrect??
I also don’t follow how the object Browser works for the same reason, & if this means I can't use the Object Browser or the pop up options to assist with writing code, what other more reliable sources are there?
I thought if the suggestion that came up as suggested by the Object Browser it should work when run, what am I missing here?
Example;
I start to write some lines of code to open a new blank Powerpoint Presentation as follows;
Option Explicit
Sub ppt_open()
‘Declare application & presentation
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Set PPApp = New PowerPoint.Application
‘Open the Powerpoint application
PPApp.Visible = True
‘The next action I want is to open a new blank Powerpoint Presentation, so I use 'the inbuilt options I’m provided each time I add a period after I select an option & 'I can write the below;
Set PPPres = PPApp.Presentations.Open
When I go to run this line, I get a compile error “Argument not Optional”
So firstly, I thought the error may be that I also get prompted for more options if I add a period, so I should select options until no more options appear.
So, adding to the “Set PPPres = PPApp.Presentations.Open” line until I don’t get prompted anymore, I ended up with the below ‘best assumption’ of the options supplied to open a new blank presentation.
Set PPPres = Presentations.Open.SlideShowWindow.Activate
Predictably, it errors for the same reason.
Is the lesson here that I should know after the “Set PPPres = PPApp.Presentations.Open” causes an error that I’m going down the wrong path & should choose another option after “Set PPPres = PPApp.Presentations…….”?
Any tips or links on how to use the inbuilt functions of the Visual Basic editor or the Object Browser would be appreciated, Thanks