common dialog woes!

common dialog woes!

Anonymous
Not applicable
525 Views
14 Replies
Message 1 of 15

common dialog woes!

Anonymous
Not applicable
I used to have access to MS common dialog controls for my VBA applications.
I always assumed it was because I have Visual Studio.net on my machine but when I got a new computer I no longer have access to the common dialog control even though I have Visual Studio.net on the new machine also.
I tried Regsvr32 comdlg32.ocx. It said it's registrered but it still won't work in VBA
I just don't get it.
0 Likes
526 Views
14 Replies
Replies (14)
Message 2 of 15

Anonymous
Not applicable
Even if you have it on your machine it isn't licenced to be used with VBA. You should be able to find a solution somewhere here http://discussion.autodesk.com/search!execute.jspa?numResults=25&source=viewforum%7C33&q=commondialog&objID=f33&search=Search
Regards - Nathan
0 Likes
Message 3 of 15

Anonymous
Not applicable
Thanks Nathan, but a couple of years ago I found either here or the msdn link a posting that describes exactly how to license it and from then on I was able to use it.
Now that I've changed computers I'm back to square one.
0 Likes
Message 4 of 15

Anonymous
Not applicable
sdanis wrote: > Thanks Nathan, but a couple of years ago I found either here or the msdn link a posting that describes exactly how to license it and from then on I was able to use it. Why bother when there's plenty of open-source replacements with no licensing restriction? -- There are 10 kinds of people: those who understand binary and those who don't.
0 Likes
Message 5 of 15

Anonymous
Not applicable
Could you perhaps point out where some of these "free" replacements can be found.

Thanks.
0 Likes
Message 6 of 15

Anonymous
Not applicable
Joe ...


wrote in message news:5557434@discussion.autodesk.com...
Could you perhaps point out where some of these "free" replacements can be
found.

Thanks.
0 Likes
Message 7 of 15

Anonymous
Not applicable
Thanks Joe. I am trying use your book to write some programs and I am fairly new to VBA. Your book is the primary resource I have found and it is very useful.

Scott
0 Likes
Message 8 of 15

Anonymous
Not applicable
So far I am making progress. However, once I get the file selected my objBlockRef will not set a value. The line I am using is:

set objBlockRef = ThisDrawing.ModelSpace.InsertBlock(varInsertionPoint, FileSelected, dblX, dblY, dblZ, dblRotation)

FileSelected has the value from ShowOpen, but it is not being recognized. Any thoughts on this?

Thanks.

Scott
0 Likes
Message 9 of 15

Anonymous
Not applicable
is it in your support path? does it have the full path?

wrote in message news:5558288@discussion.autodesk.com...
So far I am making progress. However, once I get the file selected my
objBlockRef will not set a value. The line I am using is:

set objBlockRef = ThisDrawing.ModelSpace.InsertBlock(varInsertionPoint,
FileSelected, dblX, dblY, dblZ, dblRotation)

FileSelected has the value from ShowOpen, but it is not being recognized.
Any thoughts on this?

Thanks.

Scott
0 Likes
Message 10 of 15

Anonymous
Not applicable
Yes. It works up to the point where it is supposed create the objBlockRefence object. FileSelected has the file name with path as a string and should be able to create the object using the call ThisDrawing.ModelSpace.InsertBlock command. The code is listed below. The ShowOpen is a call to the code Joe Sutphin provided in an earlier post.

I am beginning to wonder if I should use ThisDrawing.Add to first create an objBlockRef and then try to insert it?

Private Sub btnOpenFile_Click()
Dim objBlockRef As AcadBlockReference
Dim varInsertionPoint As Variant
Dim dblX As Double
Dim dblY As Double
Dim dblZ As Double
Dim dblRotation As Double
Dim usr3 As Double
usr3 = ThisDrawing.GetVariable("USERR3")

dblX = usr3
dblY = usr3
dblZ = usr3
dblRotation = 0
varInsertionPoint = "0,0,0"

' InsertBlock.Show
Dim Filter As String
Dim InitialDir As String
Dim DialogTitle As String
Dim FileSelected As String

Filter = "Drawing Files (*.dwg)" + Chr$(0) + "*.dwg" + Chr$(0) + "All Files (*.*)" _
+ Chr$(0) + "(*.*)" + Chr$(0)
InitialDir = "S:\Shared\Elec\Acade 2006"
DialogTitle = "Open a DWG file"
FileSelected = ShowOpen(Filter, InitialDir, DialogTitle)

Me.hide

'create the object
On Error Resume Next
Set objBlockRef = ThisDrawing.ModelSpace.InsertBlock(varInsertionPoint, FileSelected, dblX, dblY, dblZ, dblRotation)

If Err Then
MsgBox "Unable to insert this block."
Exit Sub
End If
objBlockRef.Update
Me.Show

End Sub
0 Likes
Message 11 of 15

Anonymous
Not applicable
Hopefully this will help narrow the focus on the problem I am having. I moved the On Error code to after the InsertBlock code and the following error code popped up:

Run Time Error '5'
Invalid procedure call or argument.

Anyone got an idea why I am getting this error?

Thanks.
0 Likes
Message 12 of 15

Anonymous
Not applicable
One more thing. When I look at the value of the variable FileSelected, a string, it has a box at the end of the text and before the close quotes. I am curous what that is and why is it there? Is it what is causing my error?

Thanks.
0 Likes
Message 13 of 15

Anonymous
Not applicable
Dim InsertionPoint(0 To 2) As Double

InsertionPoint(0) = 0: InsertionPoint(1) = 0: InsertionPoint(2) = 0

The insertion point is not a string value as you have it.

Joe ...


wrote in message news:5558921@discussion.autodesk.com...
Yes. It works up to the point where it is supposed create the
objBlockRefence object. FileSelected has the file name with path as a
string and should be able to create the object using the call
ThisDrawing.ModelSpace.InsertBlock command. The code is listed below. The
ShowOpen is a call to the code Joe Sutphin provided in an earlier post.

I am beginning to wonder if I should use ThisDrawing.Add to first create an
objBlockRef and then try to insert it?

Private Sub btnOpenFile_Click()
Dim objBlockRef As AcadBlockReference
Dim varInsertionPoint As Variant
Dim dblX As Double
Dim dblY As Double
Dim dblZ As Double
Dim dblRotation As Double
Dim usr3 As Double
usr3 = ThisDrawing.GetVariable("USERR3")

dblX = usr3
dblY = usr3
dblZ = usr3
dblRotation = 0
varInsertionPoint = "0,0,0"

' InsertBlock.Show
Dim Filter As String
Dim InitialDir As String
Dim DialogTitle As String
Dim FileSelected As String

Filter = "Drawing Files (*.dwg)" + Chr$(0) + "*.dwg" + Chr$(0) + "All
Files (*.*)" _
+ Chr$(0) + "(*.*)" + Chr$(0)
InitialDir = "S:\Shared\Elec\Acade 2006"
DialogTitle = "Open a DWG file"
FileSelected = ShowOpen(Filter, InitialDir, DialogTitle)

Me.hide

'create the object
On Error Resume Next
Set objBlockRef = ThisDrawing.ModelSpace.InsertBlock(varInsertionPoint,
FileSelected, dblX, dblY, dblZ, dblRotation)

If Err Then
MsgBox "Unable to insert this block."
Exit Sub
End If
objBlockRef.Update
Me.Show

End Sub
0 Likes
Message 14 of 15

Anonymous
Not applicable
Voila, that took care of the problem. Thanks.
0 Likes
Message 15 of 15

Anonymous
Not applicable
You're quite welcome.

Joe ...

wrote in message news:5559627@discussion.autodesk.com...
Voila, that took care of the problem. Thanks.
0 Likes