From: Fye on
Thanks - I downloaded the "mdlCommonDialog" module, and I have all the
functions loaded into VBA, but I need a little help - what do I used to
set hWndOwner?

For example, given the function:

Public Function ShowColor(hWndOwner As Long, Optional nFlags As Long)
As Long

, how would I call that function (setting hWndOwner to what???). I
understand the nFlags, but hWndOwner is a bit outside my realm of
programming.

Thanks

From: Tin Man on
Ben,

1. Original working directory "c:\jj\sldworks\" . Your working
directory "C:\New Folder". Notice you're missing a backslash (\) at the
end.
2. Changed the file type to open ".SLDPRT". This might be a case
sensitive problem.
Replace:
If Right(Response, 7) = swDocType Then
With
If Ucase(Right(Response, 7)) = Ucase(swDocType) Then

Ken

From: Ben Eadie on
Ken

Thanks! you have helped alot, this missing '/' was one of the problems.

But...When running the original macro the density of the part does not
change? It does however cycle through the files and re-saves them

Also My drawing macro does not work, doesn't open save and close the
drawings. Will this effect anything:

Set ModelDoc = swApp.OpenDoc2(Response, swDocPART, readOnly, viewOnly,
silent, ReturnVal)

Note the 'swDocPART', should I change this to 'swDocDRAWING'?


Tin Man wrote:
> Ben,
>
> 1. Original working directory "c:\jj\sldworks\" . Your working
> directory "C:\New Folder". Notice you're missing a backslash (\) at the
> end.
> 2. Changed the file type to open ".SLDPRT". This might be a case
> sensitive problem.
> Replace:
> If Right(Response, 7) = swDocType Then
> With
> If Ucase(Right(Response, 7)) = Ucase(swDocType) Then
>
> Ken
>
From: Ben Eadie on
Ok further to my last
I seem to be able to get my drawing opening to work now but on the first
file open I get "Run time error 91" Object variable or with block
variable not set. which the debugger takes me to this line in the code.

Success = ModelDoc.SetUserPreferenceDoubleValue(7, 2699)
' kg/(cu meter)

After this I have
Part.SetUserPreferenceIntegerValue swUnitsLinear, swINCHES
Part.SetUserPreferenceIntegerValue swUnitsLinearDecimalDisplay, swFRACTION
Part.SetUserPreferenceIntegerValue swUnitsLinearFractionDenominator, 16
Part.SetUserPreferenceToggle swUnitsLinearRoundToNearestFraction, True
Part.SetUserPreferenceIntegerValue swUnitsAngularDecimalPlaces, 0

to reset the drawing units.

Ben

Sorry bout the crash course in code you guys seem to be giving me.



Tin Man wrote:
> Ben,
>
> 1. Original working directory "c:\jj\sldworks\" . Your working
> directory "C:\New Folder". Notice you're missing a backslash (\) at the
> end.
> 2. Changed the file type to open ".SLDPRT". This might be a case
> sensitive problem.
> Replace:
> If Right(Response, 7) = swDocType Then
> With
> If Ucase(Right(Response, 7)) = Ucase(swDocType) Then
>
> Ken
>
From: Tin Man on
Ben,

Just delete this line:
Success = ModelDoc.SetUserPreferenceDoubleValue(7, 2699) ' kg/(cu
meter)

>>>
Set ModelDoc = swApp.OpenDoc2(Response, swDocPART, readOnly, viewOnly,
silent, ReturnVal)
Note the 'swDocPART', should I change this to 'swDocDRAWING'?
<<<
Yes you need to change it.

>>>
Part.SetUserPreferenceIntegerValue swUnitsLinear, swINCHES
Part.SetUserPreferenceIntegerValue swUnitsLinearDecimalDisplay,
swFRACTION
Part.SetUserPreferenceIntegerValue swUnitsLinearFractionDenominator, 16

Part.SetUserPreferenceToggle swUnitsLinearRoundToNearestFraction, True
Part.SetUserPreferenceIntegerValue swUnitsAngularDecimalPlaces, 0
<<<
Replace all of the "Part." with "ModelDoc."

Ken