A VBA Newbie

A VBA Newbie

Anonymous
Not applicable
385 Views
6 Replies
Message 1 of 7

A VBA Newbie

Anonymous
Not applicable
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.
0 Likes
386 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
> 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.)
0 Likes
Message 3 of 7

Anonymous
Not applicable
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" wrote in message news:41bf4f28$1_1@newsprd01... > >> 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.) > >
0 Likes
Message 4 of 7

Anonymous
Not applicable
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" 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" wrote in message > news:41bf4f28$1_1@newsprd01... > > > >> 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.) > > > > > >
0 Likes
Message 5 of 7

Anonymous
Not applicable
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" 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" 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" wrote in message >> news:41bf4f28$1_1@newsprd01... >> > >> >> 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.) >> > >> > >> >> > >
0 Likes
Message 6 of 7

Anonymous
Not applicable
"John" wrote in message news:41c03800_2@newsprd01... > 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. 😉
0 Likes
Message 7 of 7

Anonymous
Not applicable
No problem. You can also look up CopyFrom in help for an example and what other objects use this method. -- ---- Ed ---- "John" wrote in message news:41c03800_2@newsprd01... > 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" 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" 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" wrote in message > >> news:41bf4f28$1_1@newsprd01... > >> > > >> >> 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.) > >> > > >> > > >> > >> > > > > > >
0 Likes