ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with Drawing Lines Using VB6.0 (https://www.excelbanter.com/excel-programming/360211-help-drawing-lines-using-vb6-0-a.html)

James Walker

Help with Drawing Lines Using VB6.0
 
Hello all,



I have a created a program using VB6.0 that makes an Excel spreadsheet.
Within the spreadsheet, the VB6 program draws lines using coordinates (eg.
Sheet.Shapes.AddLine(122.25, 471#, 132.75, 471#).Line.Weight = 1.5)



For most of the users, this works fine, however I have a few users that have
the lines slightly shifted to the left and down from where they should be.



All users have the same version of VB6 program and same version (with
Service Pack) of Excel. Is there some sort of setting in Excel that the user
can change the coordinate system?



Thanks for any help,

James Walker, Jr.





Tom Ogilvy

Help with Drawing Lines Using VB6.0
 
The zoom setting is probably not set to 100%.

this gives me a slightly different location when using your code.

Perhaps you want to anchor to a cell

Sub DrawLine()
With Worksheets("Sheet1").Range("C37")
ActiveSheet.Shapes.AddLine(BeginX:=.Left + 0.5 * .Width, _
BeginY:=.Top + 0.5 * .Height, _
EndX:=.Left + 0.5 * .Width + 12, _
EndY:=.Top + 0.5 * .Height).Line.Weight = 1.5
End With
End Sub

--
Regards,
Tom Ogilvy


"James Walker" wrote:

Hello all,



I have a created a program using VB6.0 that makes an Excel spreadsheet.
Within the spreadsheet, the VB6 program draws lines using coordinates (eg.
Sheet.Shapes.AddLine(122.25, 471#, 132.75, 471#).Line.Weight = 1.5)



For most of the users, this works fine, however I have a few users that have
the lines slightly shifted to the left and down from where they should be.



All users have the same version of VB6 program and same version (with
Service Pack) of Excel. Is there some sort of setting in Excel that the user
can change the coordinate system?



Thanks for any help,

James Walker, Jr.







All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com