I couldn't find a solution on how to assign a single variable data to mulple objects in illustrator.
I have two text objects in illustrator document. I need to show same text in both objects. If I assign single variable to the second object will unassign that variable with the first one.
Is there any solution for using a single variable with multiple objects in Adobe Illustrator?
Look, here your data set (CSV-file):
var1,var2,var3
a1,b1,c1
a2,b2,c2
a3,b3,c3
Here are your text objects:
Click 'Import', select your csv file with data set and get the variables var1, var2, var3 in the palette:
Select your text objects, select a variable, say variable var2 and click 'Make Text Dynamic':
Now you have 3 variables var2
Select Data Set 1:
And content all of the three text objects will change with value ('b1') from var2 in your csv file:
If you will change data set to 'Data Set 2', you will get 'b2', etc.
Related
Sub getTrailInfo()
Dim attr As Variant
Dim attrTB As String
attrNames = Split("trailName,trailType,aSideSite,zSideSite,status", ",")
Dim trailForm As New formTrailInfo
For Each attr In attrNames
attrTB = attr + "TB"
trailForm.attrTB = attr
Next attr
trailForm.Show
End Sub
When I run the above code it gives a compilor error: Method or Data not found at line trailForm.attrTB = attr
I have required variables in attrNames String array. I need to put values of these variables in corosponding textboxes in a userForm. The name of Text Box in this userForm is attrNameTB. For example Text box for trailName is trailNameTB.
You cannot use VBA like that.
When you start your code, the compiler will first compile the code and check that you want to access a property named attrTB of your form. This doesn't exist and you will get the error you mentioned.
The compiler cannot wait until your variable attrTB has an actual value and then guess that you don't want a property with that name, but use the content of that variable as property name.
However, every form has a collection of all it's controls (button, edit boxes, combo boxes, labels...), and you can access the members of a collection either by index or by name. As you have the name of the control in attrTB, you could simply write
trailForm.Controls(attrTB).Text = attr
I'd like to insert the text string into the existing rich text field data at the first position for all of documents in a DB.
NotesRichTextNavigator.FindFirstElement method - This method needs to specify the element type to search but I simply insert the text at the first position of the rich text data.
This might be very basic question, but I could not find the way and waste a few hours... Please help me!
You can do this using a workaround. Instead of working with FindFirstElement, you create a dummy richtextitem, containing the text that you need to prepend to your original item,
add the original item to the dummy item, delete the original item and recreate it.
Then add the dummy item and delete the dummy.
This sounds complex, but it is not that hard actually. Here's a small example in LotusScript on how to do this on a document:
'Get your richtext field
Set rtf = doc.getfirstItem("myRTF")
'create the dummy
Set rtDummy = doc.Createrichtextitem("rtfDummy")
'set the text that you want to insert in your richtext field
Call rtDummy.appendText("Inserting a line of text at the top")
'Add a line to make sure the inserted text is on a separate paragraph
Call rtDummy.Addnewline(1, true)
'Add the content of the original richtext item
Call rtDummy.Appendrtitem(rtf)
'Remove the original item and recreate it
Call rtf.Remove()
Set rtf = doc.Createrichtextitem("myRTF")
'Append the dummy item (including the added text)
Call rtf.Appendrtitem(rtDummy)
'Remove the dummy item
Call rtDummy.Remove()
'Save the document
Call doc.Save(True, True)
I'm writing some code in MS Access and I reached to the point where user needs to choose on which worksheet of an Excel workbook there need to be performed some operation. I don't know, what name of this worksheet is or on which position it is placed.
I was thinking about a solution which will show user a form (as modal form) with listbox containing all sheets names'. When user click one of them form will show aside A1:J10 range (so user can choose the right one worksheet). After confirming choosen worksheet it will return as worksheet object.
Every thing was great untill I wanted to pass a object variable to the form. In openArgs I can only pass a string. I was even thinking about a class which will open this form but it's still no luck with passing object parameter.
I'm trying to avoid global/public variables.
Any ideas?
Assuming your object is wsObj, can't you just use wsObj.Name ?
Also have a look at wsObj.CodeName, which may be interesting as well.
There are many possibilities to send some value between objects.
A) Using Global vars into ACCESS Vba module
Global yourvariable As String
if you need some different value can use Variant, Single, etc.
B) Using Windows Register
To save value:
SaveSetting "yourprojectname", "Settings", "yourvariable", yourvalue
To retrieve value:
retvalue = GetSetting("yourprojectname", "Settings", "yourvariable", "your_default_value_if_not_exist")
C) Using OpenArg into Open Form command procedure
DoCmd.OpenForm "stDocName", acNormal, "filter_if_needed", "stlinkcriteria", acFormEdit, acWindowNormal, "arguments_forOpenArgs"
On destination form
Private Sub Form_Open(cancel as integer)
your_args=Me.OpenArgs
On all three possible solutions you can send more than one value using a chain with vars and values, an example:
myvar_mutiple="name=John Doe|address=Rua del Percebe 34|location=Madrid|phone=34 91 1234567"
On this example i used "pipe" (AltGr on key 1) char to separate each var=value
Then on destination procedure only need split each pair:
splitvar=Split(myvar_multiple,"|")
With this you obtain for each "splitvar" an element like "name=John Doe"
Do again an split with "=" to obtain variable an value. For each value you can reassign the result to a local vars.
Full code example:
if me.OpenArgs<>"" then
splitvar=Split(me.OpenArgs,"|")
for x=0 to ubound(splitvar)
tmpsplit=Split(splitvar(x),"=")
paramvars=tmpsplit(0)
paramvalue=tmpsplit(1)
select case paramvars
case "name"
stname=paramvalue
case "address"
straddress=paramvalue
case "location"
strlocation=paramvalue
case "phone"
strphone=paramvalue
end select
next
end if
Some recommendations that i use for this code "multiple vars":
- always use Low Case variable or change this:
paramvars=tmpsplit(0)
by
paramvars=lcase(tmpsplit(0))
-if you need to use "=" into value you can change by other alternative char or search the first "=" form left (i used this solution instead Split)
paramvars=trim(lcase(left(splitvar(x),len(splitvar(x))-(len(splitvar(x))-instr(splitvar(x),"="))-1)))
remember that you can send any value and can be converted on destination code. On this sample i use only String so you can use cLng or cInt etc.
Over your solution to select Sheet on excel from Access i think there are better alternatives.
IN the forms Module you can declare a property as object and then set that property once loaded. So in the form module
Option Explicit
Private myObj as object
Property Set DesiredWorksheet(o as object)
set myobj = o
End
and then in your code
Load myform
set myform.desiredworksheet = wsObj
myform.show
Ahh, sorry I was writing Excel not Access!!!
Docmd.openform f
f.desiredworksheet = ws.obj
docmd.openform f, windowmode:=acdialog
ought to work
I have some data in an excel file.
At first, I read the file and create a list of names stored in a cell through this command:
[status,sheets] = xlsfinfo(filename);
and I get:
sheets = {'A1','A2','B1','B2','C1'};
(these are the names of excelsheets in the excel file)
and through some process I obtain a matrix for each of these names (excelsheets). The final matrix for each is called:
completeData = [x,v,z,y,s];
Now, I want to:
change the name of "completeData" variable to each of its corresponding excelsheet (from the "sheets" cell).
then save this newly renamed variable (the old "completeData") with the name of its corresponding excelsheet (again from the "sheets" cell).
So far, I have only managed to save each completeData matrix resulting for each excel sheet separately with the name of the sheets [which is point number 2] through this command:
save(sprintf('%s',sheets{excelSheet}),'completeData');
(here I have a loop over "excelsheet")
The problem is that when I have mange excel sheets, and save all of them in a folder my hard disk, whenever I run any of these saved variables I get "completeData" in the workspace which is not what I want. I want to get also the name of the excelsheet.
How can I do this?
P.S. through this command:
eval(sprintf([sheets{excelsheet} '=completeData;']));
(again another loop over excelsheet)
I have managed to create several matrices with the names of excel sheets. But I do not know how I can save these very good newly created variables through a loop so that I do not do it one by one.
Following up the comments above, I tried to write you a simplified example:
%% Initialise
names = {'name1', 'name2', 'name3'};
data = randn(10, 3);
%% it create three fields called name1, name2 and name3 from data, in s
for ind=1:size(data, 2)
s.(names{ind}) = data(:, ind);
end
Hope it helps!
So this is how it worked:
First read information:
[status,sheets] = xlsfinfo(filename);
NamesList = sheets(:,1);
Now, apply the primarily collected information to read again with details:
for ind = 1:length(NamesList)
% Only read those particular sheets
[num,txt,raw] = xlsread(filename,NamesList{ind,:});
var.(NamesList{ind})={txt(:,MyColumn),num};
clear num txt raw
end
I'm trying to assign the cell values in TCOM using function call. But i See the exact function name getting printed.
set application [::tcom::ref createobject "Excel.Application"]
set workbooks [$application Workbooks]
$application DisplayAlerts False
set workbook [$workbooks Open "\\$filename.csv"]
set worksheets [$workbook Worksheets]
set worksheet [$worksheets Item [expr 1]]
set cells_worksheet1 [$worksheet Cells]
$cells_worksheet1 Item 27 B $Attribute
I want to replace $cells_worksheet1 Item 27 B $Attribute to $cells_worksheet1 Item 27 B {[getAttribute]} where getAttribute function returns $attribute. Any idea how to do this?
As far as I can see from the Excel API, you get a Range back from the Cells property, and a further Range back from its Item member. You can then access the properties of that individual item using the property accessors.
# Assuming your largely-perfect code from your question...
set cell [$cells_worksheet1 Item 27 B]
set orientation [$cell Orientation] ;# Arbitrary example of getting a property
$cell Orientation 42 ;# Setting the property
You can get the name of the property to manipulate from sources other than literals:
proc getAttribute {} {
return "Orientation"
}
puts "orientation is [$cell [getAttribute]]" ;# Note, *no* {braces} involved!
That won't necessarily work well for all properties though; the problem isn't that you can't ask for them, but rather some want additional information passing in when you fetch them and others take extra work to extract once fetched as they are compound objects themselves. It's hard to give better advice without knowing exactly what you're planning to do with it.
The issue with the braces was that Tcl treats them as being exact substitution-free literals. That's great when you're declaring a procedure, but not so useful when you want to call that procedure and use the results.