LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default loop question trying to bring excel into autocad text not starting in correct place

The following keeps incrementing the variable dist such that the text
that should start where the inspt (text insertion point) is instead
starts a multiple of dist from the inspt
For example if my excel begrow is 10, the text in autocad is starting
(dist * begrow row + 1).

Help

Mary
------------------------
Dim rownum As Long

Dim textstring As String
Dim height1 As Double
Dim excel As Object
Dim inspt As Variant
Dim lastrow As Long
Dim rng As Range
Dim endrow As Long
Dim endcol As Long

Dim begrow As Long
Dim begcol As Long
Dim acad As Object

Private Sub CommandButton1_Click()
Set excel = GetObject(, "Excel.Application")
If Err < 0 Then

Err.Clear
Set excel = CreateObject("Excel.Application")
If Err < 0 Then
MsgBox "Could not load Excel.", vbExclamation
End
End If
End If

On Error GoTo 0
excel.Visible = True
excel.Application.WindowState = xlMaximized
'excel.Sheets("Sheet1").Select
Set excelsheet = excel.ActiveWorkbook.Sheets("Sheet1")
Set rng = excel.Application.InputBox(Prompt:="Select range", Type:=8)
begrow = rng(1).Row
begcol = rng(1).Column
endrow = rng(rng.Count).Row
endcol = rng(rng.Count).Column
MsgBox begrow
MsgBox endrow
excelacadform.Hide

excel.Application.WindowState = xlMinimized

excel.Visible = False
Dim dist As Double
Dim dist1 As Double
Set acad = GetObject(, "autocad.Application")
height1 = ThisDrawing.Utility.GetReal("text height: ")
dist1 = ThisDrawing.Utility.GetReal("space between lines: ")



PtFlag1 = True
col = begcol
rownum = begrow
'dist = 0
While PtFlag1 = True

inspt = ThisDrawing.Utility.GetPoint(, "Enter a point: ")
inspt(1) = inspt(1) - dist

PtFlag = True
rownum = 1
dist = 0


While PtFlag = True

textstring = excelsheet.Cells(rownum, col).Value
'inspt(1) = inspt(1) - dist
Set textObj = ThisDrawing.ModelSpace.AddText(textstring, inspt,
height1)
textObj.HorizontalAlignment = acHorizontalAlignmentMiddle
textObj.TextAlignmentPoint = inspt
'MsgBox dist & dist1

inspt(1) = inspt(1) - dist

rownum = rownum + 1
dist = dist1
'inspt(1) = inspt(1) - dist
If rownum = (endrow + 1) Then PtFlag = False
'inspt(1) = inspt(1) - dist

Wend
col = col + 1
'inspt(1) = inspt(1) - dist

If col = (endcol + 1) Then PtFlag1 = False
'inspt(1) = inspt(1) - dist


Wend
excel.Visible = True
End Sub

 
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
fig from excel not correct decimal place when merged. In word eddieba Excel Discussion (Misc queries) 1 July 14th 09 12:54 PM
formula for text and if correct bring forward a number denise Excel Discussion (Misc queries) 5 January 11th 08 11:53 PM
AutoCAD text not printing correctly in Excel Michael Excel Discussion (Misc queries) 0 January 30th 06 08:07 PM
Why it is not pasting it to the correct place? GreenInIowa Excel Programming 6 October 14th 05 05:20 AM
display correct toolbar icon on starting excel application program ilyaskazi[_24_] Excel Programming 10 June 15th 05 03:06 PM


All times are GMT +1. The time now is 07:09 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"