Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default excel cell placement by cursor

I'm trying to get the x's and y's autocad coordinate locations placed into a
open excel sheet by having the user pick the start cell by cursor. can I do
that?

sample would look like this where the row number is set by some focus by the
users.
row1cell1 row1cell2 row1cell3 row1cell4
x1,y1 to x2,y2 distance

I guess I need to check if excel is running if it is then select the cursor
location if not then message open summary excel file. next issue is how do I
from excel flip back to autocad to get the next two points to be located and
have excel jump to start row - 1

Any comments or direction are welcome
Thanks
John Coon

'excel ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,
Option Explicit

Public intRow As Integer
Public strCell As String

' Application - Excel
Public oExcel As Excel.Application
Public oBook As Excel.Workbook
Public oSheet As Excel.Worksheet
'or I need to just connect to the already open file
Private Sub CreateExcel()
Dim i As Integer
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
Set oSheet = oBook.Worksheets(1)

oExcel.Visible = True
End Sub
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,

Sub insertpoints()
Dim varDataPnt1 As Variant
Dim dblnorthing As Double
Dim dbleasting As Double
Dim dbldir As Double
Dim pi As Double
pi = 3.14159265358979

Dim dblRot As Double
dblRot = -ThisDrawing.GetVariable("VIEWTWIST")
Dim dblRot180 As Double

dblRot180 = (dblRot + pi)

'this is the screen pick point
varDataPnt1 = ThisDrawing.Utility.GetPoint(, "Select first point: ")

Dim insertionPnt1(0 To 2) As Double
insertionPnt1(0) = varDataPnt1(0) 'x
insertionPnt1(1) = varDataPnt1(1) 'y
varDataPnt1(2) = 0 'z

MsgBox "The Northing Easting Point Location:" & vbCrLf & _
" Northing: " & varDataPnt1(1) & vbCrLf & _
" Easting: " & varDataPnt1(0) & vbCrLf & vbCrLf & _
" Direction: " & dbldir, vbInformation, "Left R/W End Coordinate
Data"
Dim pt1 As Variant
pt1 = varDataPnt1 ' x,y,z, of pick point


Dim varDataPnt2 As Variant
'this is the screen pick point
varDataPnt2 = ThisDrawing.Utility.GetPoint(, "Select Second point: ")
Dim insertionPnt2(0 To 2) As Double
insertionPnt2(0) = varDataPnt2(0) 'x
insertionPnt2(1) = varDataPnt2(1) 'y
varDataPnt2(2) = 0 'z

MsgBox "The Northing Easting Point Location:" & vbCrLf & _
" Northing: " & varDataPnt2(1) & vbCrLf & _
" Easting: " & varDataPnt2(0) & vbCrLf & vbCrLf & _
" Direction: " & dbldir, vbInformation, "Right R/W End Coordinate
Data"
Dim pt2 As Variant
pt2 = varDataPnt2 ' x,y,z, of pick point

'length calc from pick points
Dim x, y, dist As Double
x = varDataPnt1(0) - varDataPnt2(0)
y = varDataPnt1(1) - varDataPnt2(1)
dist = Sqr(x ^ 2 + y ^ 2)


Dim distformat As String
distformat = "#0.00"
Dim pointdist As String
pointdist = Format(dist, distformat)

MsgBox "Distance Between PT1 and PT2 = " & pointdist

End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Placement of cursor in drop dwn menu Bruce B New Users to Excel 3 January 7th 09 08:23 PM
Cursor placement without Macro/VBA dwiba New Users to Excel 3 December 20th 07 01:27 PM
Cursor Placement Adrienne New Users to Excel 2 November 3rd 07 02:15 PM
Controlling Cell/Cursor Placement MarkT Excel Discussion (Misc queries) 3 August 17th 05 02:54 PM
Cursor placement Randy New Users to Excel 1 July 11th 05 02:01 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"