矢印型シェイプの向き調整 

矢印型シェイプの向き調整

ここはメモ。

Sub Macro4() '=DEGREES(ATAN((y2-y1)/(x2-x1)))
    Dim kakudo As Double
    Dim x1 As Double: x1 = Selection.ShapeRange.Item(1).Left + Selection.ShapeRange.Item(1).Width - (Selection.ShapeRange.Item(1).Width / 2)
    Dim x2 As Double: x2 = Selection.ShapeRange.Item(2).Left + Selection.ShapeRange.Item(2).Width - (Selection.ShapeRange.Item(2).Width / 2)
    Dim y1 As Double: y1 = Selection.ShapeRange.Item(1).Top + Selection.ShapeRange.Item(1).Height - (Selection.ShapeRange.Item(1).Height / 2)
    Dim y2 As Double: y2 = Selection.ShapeRange.Item(2).Top + Selection.ShapeRange.Item(2).Height - (Selection.ShapeRange.Item(2).Height / 2)
    Dim adjustRotation As Integer
    If Selection.ShapeRange.Item(1).Left < Selection.ShapeRange.Item(2).Left Then
        adjustRotation = 180
    End If
    
    kakudo = Atn((y2 - y1) / (x2 - x1)) * 180 / 3.14
    Debug.Print kakudo
    Selection.ShapeRange.Item(3).Rotation = kakudo + adjustRotation
    '↑もともと左を向いてる矢印シェイプにやる
End Sub

Sub S_シェイプ間にマニュアル向けの矢印を置く()
    Dim startShape As shape
    Dim endShape As shape
    Dim connectShape As shape
    
    Dim x1 As Double
    Dim x2 As Double
    Dim y1 As Double
    Dim y2 As Double
    Dim degree As Double
    Dim adjustDegree As Integer
    Dim onShape As shape
    Dim setLeft As Double
    Dim setTop As Double
    
    If TypeName(Selection) = "Range" Then
        MsgBox "シェイプが選択されていません。2つ以上選択してください。"
        Exit Sub
    End If
    For Each shp In Selection.ShapeRange
        If shp.Type = msoGroup Or shp.Connector Then
            MsgBox "選択シェイプにグループかコネクタが含まれています。解除してください。"
            Exit Sub
        End If
    Next
    
    For i = 1 To Selection.ShapeRange.Count - 1
        '選択中シェイプの保持(接続元)
        Set startShape = Selection.ShapeRange.Item(i)
        '選択中シェイプの保持(接続先)
        Set endShape = Selection.ShapeRange.Item(i + 1)
        '各ポイントを取得
        x1 = startShape.left + startShape.width - (startShape.width / 2)
        x2 = endShape.left + endShape.width - (endShape.width / 2)
        y1 = startShape.top + startShape.height - (startShape.height / 2)
        y2 = endShape.top + endShape.height - (endShape.height / 2)
    
        If startShape.left < endShape.left Then
            adjustDegree = 180
            setLeft = startShape.left + (endShape.left - startShape.left) / 2
            setTop = startShape.top + (endShape.top - startShape.top) / 2
        Else
            setLeft = endShape.left + (startShape.left - endShape.left) / 2
            setTop = endShape.top + (startShape.top - endShape.top) / 2
        
        End If
        
        degree = Atn((y2 - y1) / (x2 - x1)) * 180 / 3.14
        
        Set onShape = ActiveSheet.Shapes.AddShape(msoShapeLeftArrow, setLeft, setTop, 200, 100)
        onShape.Rotation = degree + adjustDegree
        adjustDegree = 0
    Next
    '状況:やりたいことのイメージはOK
    'あとは矢印のスタイル、大きさ、位置の微調整
End Sub
次メモ
U_セルからセルに伸びるコネクタ
V_最初のシェイプをスキャンコピー


コメント

Steve Steinmetz さん

the product details page says to contact you for support on my recent purchase - why can't i get ahold of you guys? are your contact details wrong or something on this amazon listing? https://amzn.to/46pmr71 - please let me know asap otherwise i'll have to do a chargeback - thanks -Steve


Iola Boudreaux さん

I now offer contact form blasting service. With my DFY service you can either do a targeted blast to only websites that match your criteria or bulk blast large volumes of sites worldwide. Prices start at just $50 to reach 500,000 bulk sites. Contact me at my email or skype below for details.

P. Stewart
Skype: live:.cid.e169e59bb6e6d159
Email: ps3861 Av@gomail2.xyz


Annabelle Blair さん

With keyword targeted PPV ads I can get you qualified website visitors for less than a penny per click. This method works for both local and online businesses. Very easy to get started. Just sign up, give me your website and I'll provide the traffic.

For details, shoot me an email or Skype me at my contact info below.

P. Stewart
Skype: live:.cid.ad0ee8f191cd36b4
Email: ps39201@gomail2.xyz


Maribel Gwendolen さん

I now offer contact form blasting service. With my DFY service you can either do a targeted blast to only websites that match your criteria or bulk blast large volumes of sites worldwide. Prices start at just $50 to reach 500,000 bulk sites. Contact me at my email or skype below for details.

P. Stewart
Skype: live:.cid.e169e59bb6e6d159
Email: ps71-696@gomail2.xyz


Marcella Cary さん

Boost your website's visibility with our classified ad blasting service! We'll promote your links on 2,000+ classified ad pages, 500+ blogs, and 150+ social sites in the US and Canada. Our manual submission ensures targeted exposure, and you can track and optimize your ad's performance. Reach a broader audience and enhance your website's SEO today!

For details, shoot me an email or Skype me at my contact info below.

P. Stewart
Skype: live:.cid.f2bf75b5a952541b
Email: philstewart@myyahoo.com


Phil Stewart さん

I just delivered this message to you via your website contact form and I can do the same for your ad message to millions of websites. You can get this service for a fraction of the cost of conventional advertising.If you are interested, you can reach me via email or skype below.

P. Stewart
Email: q21ez8@gomail2.xyz
Skype: live:.cid.37ffc6c14225a4a8


Jacques Mackersey さん

New tech could give Chatgpt a run for its money. It turns your Youtube videos into video games..keeps people engaged to watch every second. You can even reward them for watching the whole video and they give you their email to get the reward ;) As seen on CBS, NBC, FOX, and ABC.

Send me an email or skype message below to see if you qualify for a free GAMIFICATION of your video.

Mike
email: gamifyvideo@gmail.com
skype: live:.cid.d347be37995c0a8d


Greta Bush さん

Are you okay running your business without much funds? This could slow down growth and delay returns on your business.

Now you have the Opportunity to Fund your Busineses and Projects without stress and without the burden of repayment as our interest in first for the growth of your business and projects, and for your to arrive at your desired business goals and dreams.

Take advantage of our Funding opportunity and get funded on your business and Projects within days and have an ample number of years/Loan Term Period which gives you time to grow and achieve your business goals.

Give us a call on:
+852 3008 8373,
or write us at:
info@capitalfund-hk.com


Phil Stewart さん

Ready to blast your message across the digital universe? Just as you're engaging with this ad, imagine your brand message reaching countless website contact forms worldwide! Starting at just under $100, unlock the potential to reach 1 million forms. Reach out to me below for details

Phil Stewart
Email: vmd8ry@mail-to-form.xyz
Skype: form-blasting


Dolores Tufnell さん

Get Found On The First Page of Google in Less Than 2 weeks by Using our Priority Stealth S.E.O. Syndication Method.

Pay us once and you'll get Organic Search Engine Results using videos that will continue to drive traffic 24/7 year round!

The Benefits are incredible - since by paying us once there will be:

- No Additional Ad spend needed!

- No Additional Costs for Ad copy!

- No Additional Costs per Clicks!

- No Commercial Licensing fees ever!

Get Started Today and Get Seen Tomorrow!

Learn More: Reviews2Videos.com


Kathrin Shackelford さん

Hey

I wanted to reach out and let you know about our new dog harness. It's really easy to put on and take off - in just 2 seconds - and it's personalized for each dog.
Plus, we offer a lifetime warranty so you can be sure your pet is always safe and stylish.

We've had a lot of success with it so far and I think your dog would love it.

Get yours today with 50% OFF: https://caredogbest.com

FREE Shipping - TODAY ONLY!

Have a great time,

Kathrin


Phil Stewart さん

Ready to blast your message across the digital universe? Just as you're engaging with this ad, imagine your brand message reaching countless website contact forms worldwide! Starting at just under $100, unlock the potential to reach 1 million forms. Reach out to me below for details

P. Stewart
Email: wgxupe@mail-to-form.xyz
Skype: form-blasting