Worf

A ricocheting ball with VBA

Worf

Well-known Member
Joined
Oct 30, 2011
Messages
4,252
Worf submitted a new Excel article:

A ricocheting ball with VBA - This article calculates the path of a ricocheting object inside a closed 2D area.

Using trigonometry, it is possible to calculate the path an object will follow when hitting the inside walls of a closed rectangular area. Here are the relevant points of the code:

  • The input variables are the starting position and angle, between 1 and 89 degrees. The values are hardcoded but this is easily modifiable.
  • Basically, the code finds the point where two lines intersect, the object path and one of the four reference lines that form the rectangle.
  • A chart is...

Read more about this Excel article...
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Maybe its a version discrepancy issue but I get "Compile error: User-defined type not defined" referencing line 128, 'Sub PPoint()'. I do still get output which defaults to starting at 16,3 and θ=20 somehow.
 
Maybe its a version discrepancy issue but I get "Compile error: User-defined type not defined" referencing line 128, 'Sub PPoint()'. I do still get output which defaults to starting at 16,3 and θ=20 somehow.
I'm realizing that the only part not working is where it is trying to create a PowerPoint. Is there some sort of permission that needs to be changed? Or do I need to do some additional setup?
 
At Excel VBA, add a reference to the Microsoft Power Point library.
 

Forum statistics

Threads
1,216,500
Messages
6,131,015
Members
449,615
Latest member
Nic0la

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top