Create picture and added it to Sheet/userform


"Excel VBA Help"

 


Play Friv Now - Play Friv Games
Go Back   The Code Cage Forums > Microsoft Topics > Microsoft Excel Forum
Our Info Pages:-
The Code Cage - Microsoft Office help

Notices

Microsoft Excel Forum Members Post questions in this forum if they are related to using Microsoft Excel, this includes Worksheet Functions, Excel VBA Programming, Simple Macro Code & Charting, Excel formula etc.

New Reply
Thread Tools Rate Thread Display Modes
  #1  
Unread 1st September 2013, 11:43
john55's Avatar
john55 john55 is offline
Forum VIP
MS Office Version: MS Office 2007
MS Office Skill Level: New to Excel
 
Join Date: Mar 2012
Location: here
Age: 47
Posts: 401
Posts Per Day: 0.40
My Top Tip Count: 0
Thanks to others: 100
Thanked 41 Times in 41 Posts
Reputation: 655 (13) john55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to behold
EEC
Default Create picture and added it to Sheet/userform
     Excel: VBA   


------ Register to get rid of these "In Post" ads! ------

Category: Excel: VBA   

Hello guys!

I have a file used for selecting the departure/arrival route based on wind direction and speed.
Every airport has a default runway.
In the first step I'd like to have, after airport selection, a "picture" of runway(s) and the wind direction.
as you can see in my example for MUC airport, there is one runway 08/26, the default is runway(to direction) 26, wind direction is from 330, speed 4kt.
the selected arrival (STAR) will be NAPSA1A
the selected departure (SID) will be MEBE1n or MEBE2S

the second step is to recommend the arrival/departure based on wind and final/first point of teh route, maybe later on!

Do you think is possible to have a picture for every selection made?
Thank you very much for your help.
Attached Files To view attachments in this forum your post count must be 2 or greater. You currently have 0 posts.
__________________
Regards, j


Last edited by john55; 1st September 2013 at 11:47.
The Code Cage Advertisment
Advertisement

To stop seeing these ads and get other benefits check This page!

  #2  
Unread 1st September 2013, 15:27
snb's Avatar
snb snb is offline
Forum VIP
MS Office Version: > Office 97
MS Office Skill Level: Interested
 
Join Date: Feb 2011
Location: Europe
Posts: 1,261
Posts Per Day: 0.90
My Top Tip Count: 0
Thanks to others: 0
Thanked 284 Times in 277 Posts
Reputation: 4695 (62) snb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond repute
Default Re: Create picture and added it to Sheet/userform

------ Register to get rid of these "In Post" ads! ------


How did you create this picture ?

  #3  
Unread 1st September 2013, 16:28
john55's Avatar
john55 john55 is offline
Forum VIP
MS Office Version: MS Office 2007
MS Office Skill Level: New to Excel
 
Join Date: Mar 2012
Location: here
Age: 47
Posts: 401
Posts Per Day: 0.40
My Top Tip Count: 0
Thanks to others: 100
Thanked 41 Times in 41 Posts
Reputation: 655 (13) john55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to behold
EEC
Default Re: Create picture and added it to Sheet/userform

------ Register to get rid of these "In Post" ads! ------


ah, just inserted shapes-oval, lines and I added the headings.
then I found this code but I have no idea how to add the lines according to rwy heading from my displayed data..
VBA CODE:
[p6].Select 
t = ActiveCell.Top 
l = ActiveCell.Left 
h = 230 'ActiveCell.Height
w = 230 'ActiveCell.Width
min_dim = IIf(h > w, w, h) 'determine thinnest dimension so circle fits that dimension and is centered correctly
v_center = t + h / 2 - min_dim / 2 
h_center = l + w / 2 - min_dim / 2 
ActiveSheet.Shapes.AddShape(msoShapeOval, h_center, v_center, min_dim, min_dim).Select 
Selection.ShapeRange.Fill.Visible = msoFalse 
With Selection.ShapeRange.Line 
    .Visible = msoTrue 
    .ForeColor.RGB = RGB(0, 0, 128) 
    .Transparency = 0 
End With 
With Selection.ShapeRange.Line 
    .Visible = msoTrue 
    .Weight = 2.25 
End With 
__________________
Regards, j

The Code Cage Advertisment
Advertisement

To stop seeing these ads and get other benefits check This page!

  #4  
Unread 1st September 2013, 16:38
snb's Avatar
snb snb is offline
Forum VIP
MS Office Version: > Office 97
MS Office Skill Level: Interested
 
Join Date: Feb 2011
Location: Europe
Posts: 1,261
Posts Per Day: 0.90
My Top Tip Count: 0
Thanks to others: 0
Thanked 284 Times in 277 Posts
Reputation: 4695 (62) snb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond repute
Default Re: Create picture and added it to Sheet/userform

------ Register to get rid of these "In Post" ads! ------


You are extremely proficient in not providing essential information

- the size and orientation of the blue line (why doesn't it go through point (0,0) ?
- the size and orientation of the green line and how it is related to the blue line
- the size and orientation of the red line and how it is related to the blue and green line ?
- the relation between some 'wind' values orientation, speed and the red line

- give some examples of values in a table (wind values included) and the lines that represent those values: i.e a 'picture'.

  #5  
Unread 1st September 2013, 17:49
john55's Avatar
john55 john55 is offline
Forum VIP
MS Office Version: MS Office 2007
MS Office Skill Level: New to Excel
 
Join Date: Mar 2012
Location: here
Age: 47
Posts: 401
Posts Per Day: 0.40
My Top Tip Count: 0
Thanks to others: 100
Thanked 41 Times in 41 Posts
Reputation: 655 (13) john55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to behold
EEC
Default Re: Create picture and added it to Sheet/userform

------ Register to get rid of these "In Post" ads! ------


I am very sorry!
1.I just draw the axes 0-180 and 90-270 just to be easier for positioning the headings added later on. I ignored the sizes, normaly the axes should be exactly on the circle.
2. The green line indicates the default rwy 26 (the departure/arrival direction), normaly it's overlapped on rwy 26, the size does not matter, just to be visible
3. The red line is the wind direction, from 330 deg, the size ...from the edge of circle to rwy's vicinity.
the wind (direction) blows from the exterior to interior of the circle
rwy 26/08, the rwy heading is painted at the threshold of it, perhaps it's weird but it's not, it indicates the direction. I mean if an airplane comes from east, it lands on rwy 26 even on the real circle is 80 deg.
the rwy notation consists of two figures, 08 means 80 deg, 26 means 260 deg.

I adeed a new test file, hope it'll be much more clear.
Thanks for your attention!
Attached Files To view attachments in this forum your post count must be 2 or greater. You currently have 0 posts.
__________________
Regards, j


Last edited by john55; 1st September 2013 at 18:25.
  #6  
Unread 3rd September 2013, 22:49
john55's Avatar
john55 john55 is offline
Forum VIP
MS Office Version: MS Office 2007
MS Office Skill Level: New to Excel
 
Join Date: Mar 2012
Location: here
Age: 47
Posts: 401
Posts Per Day: 0.40
My Top Tip Count: 0
Thanks to others: 100
Thanked 41 Times in 41 Posts
Reputation: 655 (13) john55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to behold
EEC
Default Re: Create picture and added it to Sheet/userform

------ Register to get rid of these "In Post" ads! ------


Andy has a very nice example (Thank you, Andy!) here AJP Excel Information - Drawing on a userform
is very difficult but I think it can be done, I managed to paint the circle and few rwys, it works...!
VBA CODE:
Private Sub TextBox1_Change() 
    Sheet1.Range("E6:l100").ClearContents 
     '***** circle and axes
    Set m_objDrawing = New AJPiUFDraw 
    Set m_objDrawing.CanvasUserform = Me 
    Dim shpTemp As Shape 
     
    Set shpTemp = m_objDrawing.Round(0, 0, 160) 
    If Not shpTemp Is Nothing Then shpTemp.Fill.ForeColor.RGB = RGB(255, 255, 255) 
     
    Set shpTemp = m_objDrawing.Line(197, 368, 197, 20) 
    If Not shpTemp Is Nothing Then shpTemp.Line.ForeColor.RGB = RGB(0, 0, 0) 
    If Not shpTemp Is Nothing Then shpTemp.Line.Weight = 1 
    Set shpTemp = m_objDrawing.Line(20, 190, 365, 190) 
    If Not shpTemp Is Nothing Then shpTemp.Line.ForeColor.RGB = RGB(0, 0, 0) 
    If Not shpTemp Is Nothing Then shpTemp.Line.Weight = 1 
    m_objDrawing.Paint 
     '
     'display my list
     '
     '
    Select Case UCase(TextBox1.Value) 
    Case Is = "MUC" 
        Label7 = "Default RWY 26" 
        Label8 = "RWY 26" 
        Set shpTemp = m_objDrawing.Line(360, 165, 23, 220) 
        If Not shpTemp Is Nothing Then shpTemp.Line.ForeColor.RGB = RGB(0, 255, 0) 
        If Not shpTemp Is Nothing Then shpTemp.Line.Weight = 6 
        m_objDrawing.Paint 
         
    Case Is = "MAD" 
        Label7 = "Default RWY 36" 
        Label9 = "RWY 36" 
        Set shpTemp = m_objDrawing.Line(197, 368, 197, 20) 
        If Not shpTemp Is Nothing Then shpTemp.Line.ForeColor.RGB = RGB(0, 255, 0) 
        If Not shpTemp Is Nothing Then shpTemp.Line.Weight = 6 
        Set shpTemp = m_objDrawing.Line(340, 310, 45, 70) 
        If Not shpTemp Is Nothing Then shpTemp.Line.ForeColor.RGB = RGB(0, 128, 0) 
        If Not shpTemp Is Nothing Then shpTemp.Line.Weight = 2 
        m_objDrawing.Paint 
         '
         '
__________________
Regards, j

The Following User Says Thank You to john55 For This Useful Post:
vasilis6 (22nd September 2013)
The Code Cage Advertisment
Advertisement
  #7  
Unread 7th September 2013, 07:28
john55's Avatar
john55 john55 is offline
Forum VIP
MS Office Version: MS Office 2007
MS Office Skill Level: New to Excel
 
Join Date: Mar 2012
Location: here
Age: 47
Posts: 401
Posts Per Day: 0.40
My Top Tip Count: 0
Thanks to others: 100
Thanked 41 Times in 41 Posts
Reputation: 655 (13) john55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to behold
EEC
Default Re: Create picture and added it to Sheet/userform

------ Register to get rid of these "In Post" ads! ------


Hello!

I do not know to delete the line when I change the "value" in textbox2, I mean using the below code I draw the line who represents the wind, every time when I change the value of textbox2 I need to have a line (according to textbox2.value) and the old one to be deleted, how can I do it?

I really appreciate your help.
VBA CODE:
Private Sub TextBox2_Change() 
    Dim shpTemp As Shape 
    Dim MyName As String 
    MyName = TextBox2.Value 
    If MyName = Empty Then Exit Sub 
    Select Case TextBox2.Value 
    Case Is = "060" 
        Set shpTemp = m_objDrawing.Line(360, 95, 195, 190) 
        If Not shpTemp Is Nothing Then shpTemp.Line.ForeColor.RGB = RGB(255, 0, 0) 
        If Not shpTemp Is Nothing Then shpTemp.Line.Weight = 2 
        m_objDrawing.Paint 
         
    Case Is = "040" 
        Set shpTemp = m_objDrawing.Line(260, 95, 295, 190) 
        If Not shpTemp Is Nothing Then shpTemp.Line.ForeColor.RGB = RGB(255, 0, 0) 
        If Not shpTemp Is Nothing Then shpTemp.Line.Weight = 2 
        m_objDrawing.Paint 
         
         
         
         
    End Select 
ende: 
End Sub 
__________________
Regards, j

  #8  
Unread 7th September 2013, 13:38
snb's Avatar
snb snb is offline
Forum VIP
MS Office Version: > Office 97
MS Office Skill Level: Interested
 
Join Date: Feb 2011
Location: Europe
Posts: 1,261
Posts Per Day: 0.90
My Top Tip Count: 0
Thanks to others: 0
Thanked 284 Times in 277 Posts
Reputation: 4695 (62) snb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond reputesnb has a reputation beyond repute
Default Re: Create picture and added it to Sheet/userform

------ Register to get rid of these "In Post" ads! ------


Why don't you change the properties of the existing line ?

  #9  
Unread 7th September 2013, 15:29
john55's Avatar
john55 john55 is offline
Forum VIP
MS Office Version: MS Office 2007
MS Office Skill Level: New to Excel
 
Join Date: Mar 2012
Location: here
Age: 47
Posts: 401
Posts Per Day: 0.40
My Top Tip Count: 0
Thanks to others: 100
Thanked 41 Times in 41 Posts
Reputation: 655 (13) john55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to beholdjohn55 is a splendid one to behold
EEC
Default Re: Create picture and added it to Sheet/userform

------ Register to get rid of these "In Post" ads! ------


because I do not know.
it's ok, I give up at this project.
__________________
Regards, j

The Code Cage Advertisment
Advertisement
New Reply
The Code Cage at Facebookhe Code Cage at Twitter


Tags
added, create, picture, sheet or userform

Thread Tools
Display Modes 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

Forum Jump

The Code Cage Affilliates



http://www.thecodecage.com/forumz tested by McAfee Security http://www.thecodecage.com/forumz tested by McAfee Security

All times are GMT +1. The time now is 07:37.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Template-Modifications by TMS
No part of this board, functionality or creatives may be copied or reproduced either in part or full without the express permission of The Code Cage Team.
Copyright ©2008 - , Simon lloyd.
We are not associated with nor employed by Microsoft in any way, we simply provide resources!
All MS office icons are registered trademarks of the application they represent and are used with permission from Microsoft
UA-8135493-1
Cultural Forum | Study at Malaysian University