PC Review


Reply
Thread Tools Rate Thread

With Application; Me.Top = ...

 
 
David
Guest
Posts: n/a
 
      7th May 2008
With Application
Me.Top = 0
Me.Left = 625
End With

Just hoping to advance my knowledge..
An old post of Norman Jones gave the above solution to initial positioning
of a userform on the screen using a With structure - works great.
I use 'With Structures' but this code is in a form that I've not come across
yet so it caught my eye.
I tried to educate myself by typing out the instruction without the With
Structure, eg: Application.me.top etc but I'm obviously missing a trick. Can
anyone advise what the code looks like without the 'With'?
Thanks in advance

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      7th May 2008
Me.Top = 0
Me.Left = 625

The With Application seems superfluous to me in this code snippet.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"David" <(E-Mail Removed)> wrote in message
news:103C2664-58A6-4D92-AF54-(E-Mail Removed)...
> With Application
> Me.Top = 0
> Me.Left = 625
> End With
>
> Just hoping to advance my knowledge..
> An old post of Norman Jones gave the above solution to initial positioning
> of a userform on the screen using a With structure - works great.
> I use 'With Structures' but this code is in a form that I've not come
> across
> yet so it caught my eye.
> I tried to educate myself by typing out the instruction without the With
> Structure, eg: Application.me.top etc but I'm obviously missing a trick.
> Can
> anyone advise what the code looks like without the 'With'?
> Thanks in advance
>



 
Reply With Quote
 
David
Guest
Posts: n/a
 
      7th May 2008
Thanks John,
The code is in a userform 'Activate' procedure
The 'me' must be referring to the userform
The 'with structure' in the original post sets the initial position of the
userform and not the excel application. (Your code sets the position of the
excel application on the screen)
Could you advise further on how the code is working? ie: How to write the
instructions without the 'With'
Thanks again

"John Bundy" wrote:

> the me is not necessary, you can just use
> with application
> .top=0
> .left=625
> end with
>
> I use the me's as well. So just typing it without the with:
> application.top=0
> application.left=625
>
> the with just lets you set multiple properties without retyping application.
> --
> -John
> Please rate when your question is answered to help us and others know what
> is helpful.
>
>
> "David" wrote:
>
> > With Application
> > Me.Top = 0
> > Me.Left = 625
> > End With
> >
> > Just hoping to advance my knowledge..
> > An old post of Norman Jones gave the above solution to initial positioning
> > of a userform on the screen using a With structure - works great.
> > I use 'With Structures' but this code is in a form that I've not come across
> > yet so it caught my eye.
> > I tried to educate myself by typing out the instruction without the With
> > Structure, eg: Application.me.top etc but I'm obviously missing a trick. Can
> > anyone advise what the code looks like without the 'With'?
> > Thanks in advance
> >

 
Reply With Quote
 
John Bundy
Guest
Posts: n/a
 
      7th May 2008
Ah, must have missed that part. In that case just use me.top, no application
is neccesary.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"David" wrote:

> Thanks John,
> The code is in a userform 'Activate' procedure
> The 'me' must be referring to the userform
> The 'with structure' in the original post sets the initial position of the
> userform and not the excel application. (Your code sets the position of the
> excel application on the screen)
> Could you advise further on how the code is working? ie: How to write the
> instructions without the 'With'
> Thanks again
>
> "John Bundy" wrote:
>
> > the me is not necessary, you can just use
> > with application
> > .top=0
> > .left=625
> > end with
> >
> > I use the me's as well. So just typing it without the with:
> > application.top=0
> > application.left=625
> >
> > the with just lets you set multiple properties without retyping application.
> > --
> > -John
> > Please rate when your question is answered to help us and others know what
> > is helpful.
> >
> >
> > "David" wrote:
> >
> > > With Application
> > > Me.Top = 0
> > > Me.Left = 625
> > > End With
> > >
> > > Just hoping to advance my knowledge..
> > > An old post of Norman Jones gave the above solution to initial positioning
> > > of a userform on the screen using a With structure - works great.
> > > I use 'With Structures' but this code is in a form that I've not come across
> > > yet so it caught my eye.
> > > I tried to educate myself by typing out the instruction without the With
> > > Structure, eg: Application.me.top etc but I'm obviously missing a trick. Can
> > > anyone advise what the code looks like without the 'With'?
> > > Thanks in advance
> > >

 
Reply With Quote
 
David
Guest
Posts: n/a
 
      7th May 2008
Thanks Bob,
It is superfluous, but what intrigues me is what would each line of code
look like with the 'Application' and 'Me.Top = 0' joined up into the same
line of code. Perhaps i'm looking for something that is not there and 'With
Application' 'End With' could be written around any set of instructions
without making any difference at all?

"Bob Phillips" wrote:

> Me.Top = 0
> Me.Left = 625
>
> The With Application seems superfluous to me in this code snippet.
>
> --
> HTH
>
> Bob
>
> (there's no email, no snail mail, but somewhere should be gmail in my addy)
>
> "David" <(E-Mail Removed)> wrote in message
> news:103C2664-58A6-4D92-AF54-(E-Mail Removed)...
> > With Application
> > Me.Top = 0
> > Me.Left = 625
> > End With
> >
> > Just hoping to advance my knowledge..
> > An old post of Norman Jones gave the above solution to initial positioning
> > of a userform on the screen using a With structure - works great.
> > I use 'With Structures' but this code is in a form that I've not come
> > across
> > yet so it caught my eye.
> > I tried to educate myself by typing out the instruction without the With
> > Structure, eg: Application.me.top etc but I'm obviously missing a trick.
> > Can
> > anyone advise what the code looks like without the 'With'?
> > Thanks in advance
> >

>
>
>

 
Reply With Quote
 
John Bundy
Guest
Posts: n/a
 
      7th May 2008
You might be having an issue because of how he structures it, application
contains the me, he has it but does not need it. I know that made no sense so
have a look at another way to do what he did:

With Me
..Top = 0
..Left = 150
End With

this works the same way and is easier to write and (i think) comprehend how
it would break down into
me.top=0
me.left=150

--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"David" wrote:

> Thanks Bob,
> It is superfluous, but what intrigues me is what would each line of code
> look like with the 'Application' and 'Me.Top = 0' joined up into the same
> line of code. Perhaps i'm looking for something that is not there and 'With
> Application' 'End With' could be written around any set of instructions
> without making any difference at all?
>
> "Bob Phillips" wrote:
>
> > Me.Top = 0
> > Me.Left = 625
> >
> > The With Application seems superfluous to me in this code snippet.
> >
> > --
> > HTH
> >
> > Bob
> >
> > (there's no email, no snail mail, but somewhere should be gmail in my addy)
> >
> > "David" <(E-Mail Removed)> wrote in message
> > news:103C2664-58A6-4D92-AF54-(E-Mail Removed)...
> > > With Application
> > > Me.Top = 0
> > > Me.Left = 625
> > > End With
> > >
> > > Just hoping to advance my knowledge..
> > > An old post of Norman Jones gave the above solution to initial positioning
> > > of a userform on the screen using a With structure - works great.
> > > I use 'With Structures' but this code is in a form that I've not come
> > > across
> > > yet so it caught my eye.
> > > I tried to educate myself by typing out the instruction without the With
> > > Structure, eg: Application.me.top etc but I'm obviously missing a trick.
> > > Can
> > > anyone advise what the code looks like without the 'With'?
> > > Thanks in advance
> > >

> >
> >
> >

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      7th May 2008
Only those properties/methods that start with a dot refer to the object in the
previous With statement.

Your code would have to look more like:

With Application
.Me.Top = 0
.Me.Left = 625
End With

And in this case, it's not right.

David wrote:
>
> Thanks Bob,
> It is superfluous, but what intrigues me is what would each line of code
> look like with the 'Application' and 'Me.Top = 0' joined up into the same
> line of code. Perhaps i'm looking for something that is not there and 'With
> Application' 'End With' could be written around any set of instructions
> without making any difference at all?
>
> "Bob Phillips" wrote:
>
> > Me.Top = 0
> > Me.Left = 625
> >
> > The With Application seems superfluous to me in this code snippet.
> >
> > --
> > HTH
> >
> > Bob
> >
> > (there's no email, no snail mail, but somewhere should be gmail in my addy)
> >
> > "David" <(E-Mail Removed)> wrote in message
> > news:103C2664-58A6-4D92-AF54-(E-Mail Removed)...
> > > With Application
> > > Me.Top = 0
> > > Me.Left = 625
> > > End With
> > >
> > > Just hoping to advance my knowledge..
> > > An old post of Norman Jones gave the above solution to initial positioning
> > > of a userform on the screen using a With structure - works great.
> > > I use 'With Structures' but this code is in a form that I've not come
> > > across
> > > yet so it caught my eye.
> > > I tried to educate myself by typing out the instruction without the With
> > > Structure, eg: Application.me.top etc but I'm obviously missing a trick.
> > > Can
> > > anyone advise what the code looks like without the 'With'?
> > > Thanks in advance
> > >

> >
> >
> >


--

Dave Peterson
 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      7th May 2008
It doesn't get joined up because the Application is not qualifying Me, there
is no dot before Me.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"David" <(E-Mail Removed)> wrote in message
news:CE03643E-2A77-4537-B7B2-(E-Mail Removed)...
> Thanks Bob,
> It is superfluous, but what intrigues me is what would each line of code
> look like with the 'Application' and 'Me.Top = 0' joined up into the same
> line of code. Perhaps i'm looking for something that is not there and
> 'With
> Application' 'End With' could be written around any set of instructions
> without making any difference at all?
>
> "Bob Phillips" wrote:
>
>> Me.Top = 0
>> Me.Left = 625
>>
>> The With Application seems superfluous to me in this code snippet.
>>
>> --
>> HTH
>>
>> Bob
>>
>> (there's no email, no snail mail, but somewhere should be gmail in my
>> addy)
>>
>> "David" <(E-Mail Removed)> wrote in message
>> news:103C2664-58A6-4D92-AF54-(E-Mail Removed)...
>> > With Application
>> > Me.Top = 0
>> > Me.Left = 625
>> > End With
>> >
>> > Just hoping to advance my knowledge..
>> > An old post of Norman Jones gave the above solution to initial
>> > positioning
>> > of a userform on the screen using a With structure - works great.
>> > I use 'With Structures' but this code is in a form that I've not come
>> > across
>> > yet so it caught my eye.
>> > I tried to educate myself by typing out the instruction without the
>> > With
>> > Structure, eg: Application.me.top etc but I'm obviously missing a
>> > trick.
>> > Can
>> > anyone advise what the code looks like without the 'With'?
>> > Thanks in advance
>> >

>>
>>
>>



 
Reply With Quote
 
David
Guest
Posts: n/a
 
      8th May 2008
Thanks Bob, John & Dave for clearing that one up.
I'm sure I speak for 100s of people in saying that you do an excellent job
of improving our understanding of VBA
Thanks again


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
appdata-local-Application Data-Application Data-Application Data infinitum ad nauseum. WHY keepout@yahoo.com.invalid Windows Vista General Discussion 15 16th Sep 2007 01:50 AM
Managed C++: The application failed to initialize properly (0xc000007b).Click on OK to terminate the application. Tommy Vercetti Microsoft VC .NET 4 23rd Mar 2005 08:19 PM
Fail in operating my hardware in web application , makes other windows application startup failure. Ryan.ZhYin Microsoft C# .NET 0 25th Jan 2005 08:34 AM
Please recommend book about design patterns for server application\distrubuted application Julia Microsoft C# .NET 2 11th Dec 2004 01:37 AM
Making more memory available to application?Im making a memory intense application, the application is supposed to open a prettylarge image (about 9200*10200 in 300Dpi) yosh@liquidzone.net Microsoft Dot NET Framework Forms 0 6th Dec 2004 07:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:39 PM.