A VBA Newbie
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
A VBA Newbie

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
John
Guest





Posted: Wed Dec 15, 2004 12:50 am    Post subject: A VBA Newbie Reply with quote

Hello everyone,

I'm tryting to learn VBA and I have some experience in Lisp. I'm playing
with VBA from last few weeks so I think i got some basic stuff. here is my
first CODE in VBA.

Public Sub testforplot()
Dim pagesetups As AcadPlotConfigurations
Dim pagesetup As AcadPlotConfiguration
Dim newpage1 As AcadPlotConfiguration
Set pagesetups = ThisDrawing.PlotConfigurations
Set newpage1 = ThisDrawing.PlotConfigurations.Add("test")
newpage1.PlotRotation = ac270degrees
newpage1.PlotType = acLayout
newpage1.PlotWithPlotStyles = True
newpage1.ConfigName = "Plotter.pc3"
newpage1.StyleSheet = "test.STB"
newpage1.StandardScale = ac1_1
newpage1.CanonicalMediaName = "user636"
newpage1.PlotWithLineweights = True
newpage1.ScaleLineweights = True
End Sub

I know I can use WITH statement to replace all newpage1. My question is how
to make plotconfigurations (name "test") active and assign with layouts?

I'm trying to do this but with name

If PlotConfigurations.count = 0 Then
'*** Customize the new configuration to your satisfaction ***
PlotConfigurations.Add "NEW_CONFIGURATION"
End If

Can i go by plotconfigurations name like this
If PlotConfigurations.count = "test" Then
'*** Customize the new configuration to your satisfaction ***
PlotConfigurations.Add "NEW_CONFIGURATION"
End If

Thank you for your help. I will keep posting here becasue I'm VBA Newbie.

Back to top
TomD
Guest





Posted: Wed Dec 15, 2004 1:38 am    Post subject: Re: A VBA Newbie Reply with quote

<SNIPPED>
Quote:
I know I can use WITH statement to replace all newpage1. My question is
how
to make plotconfigurations (name "test") active and assign with layouts?

I'm trying to do this but with name

If PlotConfigurations.count = 0 Then
'*** Customize the new configuration to your satisfaction ***
PlotConfigurations.Add "NEW_CONFIGURATION"
End If

Can i go by plotconfigurations name like this
If PlotConfigurations.count = "test" Then
'*** Customize the new configuration to your satisfaction ***
PlotConfigurations.Add "NEW_CONFIGURATION"
End If

If I remember correctly, you have to use the CopyFrom method of the layout
to apply a PlotConfiguration's settings.

.....that's how I've been doing it, anyway. (It seemed counterintuitive, at
first.....at least to me.)
Back to top
John
Guest





Posted: Wed Dec 15, 2004 2:02 am    Post subject: Re: A VBA Newbie Reply with quote

Thank you for your reply

what i really looking is, for example if you have few plotconfiguratios in
this drawing and like to make one of them active....




"TomD" <tdivittis.no@spam.cecinc.com> wrote in message
news:41bf4f28$1_1@newsprd01...
Quote:
SNIPPED
I know I can use WITH statement to replace all newpage1. My question is
how
to make plotconfigurations (name "test") active and assign with layouts?

I'm trying to do this but with name

If PlotConfigurations.count = 0 Then
'*** Customize the new configuration to your satisfaction ***
PlotConfigurations.Add "NEW_CONFIGURATION"
End If

Can i go by plotconfigurations name like this
If PlotConfigurations.count = "test" Then
'*** Customize the new configuration to your satisfaction ***
PlotConfigurations.Add "NEW_CONFIGURATION"
End If

If I remember correctly, you have to use the CopyFrom method of the layout
to apply a PlotConfiguration's settings.

....that's how I've been doing it, anyway. (It seemed counterintuitive,
at
first.....at least to me.)



Back to top
Ed Jobe
Guest





Posted: Wed Dec 15, 2004 2:15 am    Post subject: Re: A VBA Newbie Reply with quote

He gave that to you. :-) Some code might make it clearer.

If ThisDrawing.PlotConfigurations("SomePageSetup") Then
ThisDrawing.ActiveLayout.CopyFrom ThisDrawing.PlotConfigurations
"SomePageSetup"
End If

--
----
Ed
----
"John" <hendnoemail@aol.com> wrote in message news:41bf54e6_1@newsprd01...
Quote:
Thank you for your reply

what i really looking is, for example if you have few plotconfiguratios in
this drawing and like to make one of them active....




"TomD" <tdivittis.no@spam.cecinc.com> wrote in message
news:41bf4f28$1_1@newsprd01...
SNIPPED
I know I can use WITH statement to replace all newpage1. My question
is
how
to make plotconfigurations (name "test") active and assign with
layouts?

I'm trying to do this but with name

If PlotConfigurations.count = 0 Then
'*** Customize the new configuration to your satisfaction ***
PlotConfigurations.Add "NEW_CONFIGURATION"
End If

Can i go by plotconfigurations name like this
If PlotConfigurations.count = "test" Then
'*** Customize the new configuration to your satisfaction ***
PlotConfigurations.Add "NEW_CONFIGURATION"
End If

If I remember correctly, you have to use the CopyFrom method of the
layout
to apply a PlotConfiguration's settings.

....that's how I've been doing it, anyway. (It seemed counterintuitive,
at
first.....at least to me.)



Back to top
John
Guest





Posted: Wed Dec 15, 2004 6:11 pm    Post subject: Re: A VBA Newbie Reply with quote

Thanks, Yes, he gave to me but I'm new so I get little slow...:) And i got
confuse about this "copyfrom"...... I was thinking that statement something
like this activeplotfiguration = "test". anyway againg thanks for your help.

John

"Ed Jobe" <not.edljobe@hotmail.com> wrote in message
news:41bf57fd$1_3@newsprd01...
Quote:
He gave that to you. :-) Some code might make it clearer.

If ThisDrawing.PlotConfigurations("SomePageSetup") Then
ThisDrawing.ActiveLayout.CopyFrom ThisDrawing.PlotConfigurations
"SomePageSetup"
End If

--
----
Ed
----
"John" <hendnoemail@aol.com> wrote in message news:41bf54e6_1@newsprd01...
Thank you for your reply

what i really looking is, for example if you have few plotconfiguratios
in
this drawing and like to make one of them active....




"TomD" <tdivittis.no@spam.cecinc.com> wrote in message
news:41bf4f28$1_1@newsprd01...
SNIPPED
I know I can use WITH statement to replace all newpage1. My question
is
how
to make plotconfigurations (name "test") active and assign with
layouts?

I'm trying to do this but with name

If PlotConfigurations.count = 0 Then
'*** Customize the new configuration to your satisfaction ***
PlotConfigurations.Add "NEW_CONFIGURATION"
End If

Can i go by plotconfigurations name like this
If PlotConfigurations.count = "test" Then
'*** Customize the new configuration to your satisfaction ***
PlotConfigurations.Add "NEW_CONFIGURATION"
End If

If I remember correctly, you have to use the CopyFrom method of the
layout
to apply a PlotConfiguration's settings.

....that's how I've been doing it, anyway. (It seemed
counterintuitive,
at
first.....at least to me.)





Back to top
TomD
Guest





Posted: Wed Dec 15, 2004 7:55 pm    Post subject: Re: A VBA Newbie Reply with quote

"John" <hendnoemail@aol.com> wrote in message news:41c03800_2@newsprd01...
Quote:
Thanks, Yes, he gave to me but I'm new so I get little slow...:) And i
got
confuse about this "copyfrom"...... I was thinking that statement
something
like this activeplotfiguration = "test". anyway againg thanks for your
help.


Sorry about the lack of info, John. I'll take full blame for that post not
being clear enough. ;)
Back to top
Ed Jobe
Guest





Posted: Wed Dec 15, 2004 9:14 pm    Post subject: Re: A VBA Newbie Reply with quote

No problem. You can also look up CopyFrom in help for an example and what
other objects use this method.

--
----
Ed
----
"John" <hendnoemail@aol.com> wrote in message news:41c03800_2@newsprd01...
Quote:
Thanks, Yes, he gave to me but I'm new so I get little slow...:) And i
got
confuse about this "copyfrom"...... I was thinking that statement
something
like this activeplotfiguration = "test". anyway againg thanks for your
help.

John

"Ed Jobe" <not.edljobe@hotmail.com> wrote in message
news:41bf57fd$1_3@newsprd01...
He gave that to you. :-) Some code might make it clearer.

If ThisDrawing.PlotConfigurations("SomePageSetup") Then
ThisDrawing.ActiveLayout.CopyFrom ThisDrawing.PlotConfigurations
"SomePageSetup"
End If

--
----
Ed
----
"John" <hendnoemail@aol.com> wrote in message
news:41bf54e6_1@newsprd01...
Thank you for your reply

what i really looking is, for example if you have few plotconfiguratios
in
this drawing and like to make one of them active....




"TomD" <tdivittis.no@spam.cecinc.com> wrote in message
news:41bf4f28$1_1@newsprd01...
SNIPPED
I know I can use WITH statement to replace all newpage1. My
question
is
how
to make plotconfigurations (name "test") active and assign with
layouts?

I'm trying to do this but with name

If PlotConfigurations.count = 0 Then
'*** Customize the new configuration to your satisfaction
***
PlotConfigurations.Add "NEW_CONFIGURATION"
End If

Can i go by plotconfigurations name like this
If PlotConfigurations.count = "test" Then
'*** Customize the new configuration to your satisfaction
***
PlotConfigurations.Add "NEW_CONFIGURATION"
End If

If I remember correctly, you have to use the CopyFrom method of the
layout
to apply a PlotConfiguration's settings.

....that's how I've been doing it, anyway. (It seemed
counterintuitive,
at
first.....at least to me.)







Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB