I am using:
IE.ExecWB 17, 0 '// SelectAll
IE.ExecWB 12, 2 '// Copy selection
in an Excel VBA program successfully, but I am having trouble finding a reference for all ExecWB methods. Can anyone point me in the right direction?
Here is something from my database. I doubt you will find this on the web anymore. I will be surprised if you do...
ExecWB syntax is as follows:
object.ExecWB nCmdID, nCmdExecOpt, [pvaIn], [pvaOut]
The ExecWB method requires an OLE Command ID to be passed in to identify the command to execute. This value nCmdID is of type Long. The nCmdExecOpt parameter represents the value for the command execution option. Together, these values instruct the control as to what supported command to execute and what degree of user prompting should occur.
The last two parameters pvaIn and paOut are optional and is usually set to either NULL or an empty string.
Here is a complete list for the 1st parameter
OLECMDID_OPEN 1 Open
OLECMDID_NEW 2 Create a new document
OLECMDID_SAVE 3 Preservation
OLECMDID_SAVEAS 4 Save as
OLECMDID_SAVECOPYAS 5
OLECMDID_PRINT 6 Print
OLECMDID_PRINTPREVIEW 7 Print preview
OLECMDID_PAGESETUP 8 Page setup
OLECMDID_SPELL 9 The spelling check
OLECMDID_PROPERTIES 10 Attribute
OLECMDID_CUT 11 Shear
OLECMDID_COPY 12 Replication
OLECMDID_PASTE 13 Paste
OLECMDID_PASTESPECIAL 14 Paste special
OLECMDID_UNDO 15 Revoke
OLECMDID_REDO 16 Repeat
OLECMDID_SELECTALL 17 Select all
OLECMDID_CLEARSELECTION 18 Clear selection
OLECMDID_ZOOM 19
OLECMDID_GETZOOMRANGE 20
OLECMDID_UPDATECOMMANDS 21 The update command
OLECMDID_REFRESH 22 Refresh
OLECMDID_STOP 23 Stop it
OLECMDID_HIDETOOLBARS 24 Hide toolbar
OLECMDID_SETPROGRESSMAX 25 Progress bar maximum
OLECMDID_SETPROGRESSPOS 26 Progress bar position
OLECMDID_SETPROGRESSTEXT 27 Progress bar text
OLECMDID_SETTITLE 28 Set the title
OLECMDID_SETDOWNLOADSTATE 29 Set download status
OLECMDID_STOPDOWNLOAD 30 Stop downloading
OLECMDID_ONTOOLBARACTIVATED 31
OLECMDID_FIND 32 Search
OLECMDID_DELETE 33 Delete
OLECMDID_HTTPEQUIV 34
OLECMDID_HTTPEQUIV_DONE 35
OLECMDID_ENABLE_INTERACTION 36 Allow the interaction
OLECMDID_ONUNLOAD 37 When uninstall
OLECMDID_PROPERTYBAG2 38
OLECMDID_PREREFRESH 39
OLECMDID_SHOWSCRIPTERROR 40
OLECMDID_SHOWMESSAGE 41 Display a message
OLECMDID_SHOWFIND 42 Display search
OLECMDID_SHOWPAGESETUP 43 Display page setup
OLECMDID_SHOWPRINT 44 Display and printing
OLECMDID_CLOSE 45 Close
OLECMDID_ALLOWUILESSSAVEAS 46
OLECMDID_DONTDOWNLOADCSS 47
OLECMDID_UPDATEPAGESTATUS 48
OLECMDID_PRINT2 49 Print 2
OLECMDID_PRINTPREVIEW2 50 Print preview
OLECMDID_SETPRINTTEMPLATE 51 Set the print template
OLECMDID_GETPRINTTEMPLATE 52 Get a print template
OLECMDID_PAGEACTIONBLOCKED 55
OLECMDID_PAGEACTIONUIQUERY 56
OLECMDID_FOCUSVIEWCONTROLS 57
OLECMDID_FOCUSVIEWCONTROLSQUERY 58
OLECMDID_SHOWPAGEACTIONMENU 59
OLECMDID_ADDTRAVELENTRY 60
OLECMDID_UPDATETRAVELENTRY 61
OLECMDID_UPDATEBACKFORWARDSTATE 62
OLECMDID_OPTICAL_ZOOM 63
OLECMDID_OPTICAL_GETZOOMRANGE 64
OLECMDID_WINDOWSTATECHANGED 65 windows status change
Here is a complete list for the 2nd parameter
OLECMDEXECOPT_DODEFAULT 0 Default parameters
OLECMDEXECOPT_PROMPTUSER 1 Prompt the user, namely the pop-up dialog box
LECMDEXECOPT_DONTPROMPTUSER 2 User is not prompted
OLECMDEXECOPT_SHOWHELP 3 displays help
Examples
WebBrowser.ExecWB(6,1) '<~~ Print
WebBrowser.ExecWB(7,1) '<~~ Print preview
WebBrowser.ExecWB(8,1) '<~~ The printed page setup
Related
How can I export data from Excel to GAMS? I have a set i and parameter b(i).
b(0)= 30,...,b(10)=18 are:
0 30
1 17
2 21
3 32
4 19
5 29
6 24
7 20
8 23
9 27
10 18
I have an Excel file with name "Book1", my code results in ERROR 409:
Unrecognizable item - skip to find a new statement
looking for a ';' or a key word to get started again
Why? What can I do? This is my code:
set i/1*10/
parameter b(i)
$call =xls2gms r=sheet2!B3:C13 i=Book1.xlsx o=set.inc
$include set.inc
;
You need to add semicolons after each command. The only exception are the $ commands compile time commands. Fx:
set i /1*10/;
parameter b(i);
$call =xls2gms r=sheet2!B3:C13 i=Book1.xlsx o=set.inc
$include set.inc
Like in this discussion,
Tj command with angle brackets
I'm faced with TJ operator where content is between angle brackets:
<00030037005200570044004F000300550048004600520051005100580056>Tj
the parent page gives the list of font object id's like this
Font /C2_0 39 0 R/T1_0 41 0 R/T1_1 43 0 R/T1_2 44 0 R
and for the object where the angle brackets string is, a Tf operator specifies that the font reference is C2_0
So from the font list, I know the C2 font object is 39
Ok, but now, what is the fastest way to access this 39 object that is embedded in a stream object having 16 as id. In this #16 object, there is the list of embedded objects
32 0 33 106 34 131 35 141 36 193 37 436 38 16720 39 16728 ....
So my quetion is how to get the 16 value, when I only know that the font object id 39 is not in the cross reference table? Do I have to parse all stream objects and read their stream object list to detect which one has the object 39?
Thanks for your attention.
I receive the error in the header when I run this case when statement in my query. Normally this error should be resulted from missing to_date function but I believe I have everything needed, but don't know why I am receiving this really. Any help is much appreciated!
case when week=to_date('25/06/2017','YYYY/MM/DD') then 26
when week=to_date('02/07/2017','YYYY/MM/DD') then 27
when week=to_date('09/07/2017','YYYY/MM/DD') then 28
when week=to_date('16/07/2017','YYYY/MM/DD') then 29
when week=to_date('23/07/2017','YYYY/MM/DD') then 30
when week=to_date('30/07/2017','YYYY/MM/DD') then 31
when week=to_date('06/08/2017','YYYY/MM/DD') then 32
when week=to_date('13/08/2017','YYYY/MM/DD') then 33
when week=to_date('20/08/2017','YYYY/MM/DD') then 34
when week=to_date('27/08/2017','YYYY/MM/DD') then 35
when week=to_date('03/09/2017','YYYY/MM/DD') then 36
when week=to_date('10/09/2017','YYYY/MM/DD') then 37
when week=to_date('17/09/2017','YYYY/MM/DD') then 38
when week=to_date('24/09/2017','YYYY/MM/DD') then 39
when week=to_date('01/10/2017','YYYY/MM/DD') then 40
when week=to_date('08/10/2017','YYYY/MM/DD') then 41
when week=to_date('15/10/2017','YYYY/MM/DD') then 42
when week=to_date('22/10/2017','YYYY/MM/DD') then 43
when week=to_date('29/10/2017','YYYY/MM/DD') then 44
when week=to_date('05/11/2017','YYYY/MM/DD') then 45
when week=to_date('12/11/2017','YYYY/MM/DD') then 46
when week=to_date('19/11/2017','YYYY/MM/DD') then 47
when week=to_date('26/11/2017','YYYY/MM/DD') then 48
when week=to_date('03/12/2017','YYYY/MM/DD') then 49
when week=to_date('10/12/2017','YYYY/MM/DD') then 50
when week=to_date('17/12/2017','YYYY/MM/DD') then 51
when week=to_date('24/12/2017','YYYY/MM/DD') then 52
else 0 end as week,
Çağdaş, make your format like this :
to_date('25/06/2017','DD/MM/YYYY')
instead of to_date('25/06/2017','YYYY/MM/DD') and so on like this for the others. Since the order in date formatting is wrong.
The format is wrong.
You can use to_date('25/06/2017','DD/MM/YYYY') in all the expressions.
Instead of hardcoding so many times, you can use TO_CHAR function to extract Week of the year from a given date.
In your case you can use
SELECT TO_CHAR(week,'WW') from table_name;
I am interested in getting the fitted values at set locations from a clogit model. This includes the population level response and the confidence intervals around it. For example, I have data that looks approximately like this:
set.seed(1)
data <- data.frame(Used = rep(c(1,0,0,0),1250),
Open = round(runif(5000,0,50),0),
Activity = rep(sample(runif(24,.5,1.75),1250, replace=T), each=4),
Strata = rep(1:1250,each=4))
Within the Clogit model, activity does not vary within a strata, thus there is no activity main effect.
mod <- clogit(Used ~ Open + I(Open*Activity) + strata(Strata),data=data)
What I want to do is build a newdata frame at which I can eventually plot marginal fitted values at specified locations of Open similar to a newdata design in a traditional glm model: e.g.,
newdata <- data.frame(Open = seq(0,50,1),
Activity = rep(max(data$Activity),51))
However, when I try to run a predict function on the clogit, I get the following error:
fit<-predict(mod,newdata=newdata,type = "expected")
Error in Surv(rep(1, 5000L), Used) : object 'Used' not found
I realize this is because clogit in r is being run throught Cox.ph, and thus, the predict function is trying to predict relative risks between pairs of subjects within the same strata (in this case= Used).
My question, however is if there is a way around this. This is easily done in Stata (using the Margins Command), and manually in Excel, however I would like to automate in R since everything else is programmed there. I have also built this manually in R (example code below), however I keep ending up with what appear to be incorrect CIs in my real data, as a result I would like to rely on the predict function if possible. My code for manual prediction is:
coef<-data.frame(coef = summary(mod)$coefficients[,1],
se= summary(mod)$coefficients[,3])
coef$se <-summary(mod)$coefficients[,4]
coef$UpCI <- coef[,1] + (coef[,2]*2) ### this could be *1.96 but using 2 for simplicity
coef$LowCI <-coef[,1] - (coef[,2]*2) ### this could be *1.96 but using 2 for simplicity
fitted<-data.frame(Open= seq(0,50,2),
Activity=rep(max(data$Activity),26))
fitted$Marginal <- exp(coef[1,1]*fitted$Open +
coef[2,1]*fitted$Open*fitted$Activity)/
(1+exp(coef[1,1]*fitted$Open +
coef[2,1]*fitted$Open*fitted$Activity))
fitted$UpCI <- exp(coef[1,3]*fitted$Open +
coef[2,3]*fitted$Open*fitted$Activity)/
(1+exp(coef[1,3]*fitted$Open +
coef[2,3]*fitted$Open*fitted$Activity))
fitted$LowCI <- exp(coef[1,4]*fitted$Open +
coef[2,4]*fitted$Open*fitted$Activity)/
(1+exp(coef[1,4]*fitted$Open +
coef[2,4]*fitted$Open*fitted$Activity))
My end product would ideally look something like this but a product of the predict function....
Example output of fitted values.
Evidently Terry Therneau is less a purist on the matter of predictions from clogit models: http://markmail.org/search/?q=list%3Aorg.r-project.r-help+predict+clogit#query:list%3Aorg.r-project.r-help%20predict%20clogit%20from%3A%22Therneau%2C%20Terry%20M.%2C%20Ph.D.%22+page:1+mid:tsbl3cbnxywkafv6+state:results
Here's a modification to your code that does generate the 51 predictions. Did need to put in a dummy Strata column.
newdata <- data.frame(Open = seq(0,50,1),
Activity = rep(max(data$Activity),51), Strata=1)
risk <- predict(mod,newdata=newdata,type = "risk")
> risk/(risk+1)
1 2 3 4 5 6 7
0.5194350 0.5190029 0.5185707 0.5181385 0.5177063 0.5172741 0.5168418
8 9 10 11 12 13 14
0.5164096 0.5159773 0.5155449 0.5151126 0.5146802 0.5142478 0.5138154
15 16 17 18 19 20 21
0.5133829 0.5129505 0.5125180 0.5120855 0.5116530 0.5112205 0.5107879
22 23 24 25 26 27 28
0.5103553 0.5099228 0.5094902 0.5090575 0.5086249 0.5081923 0.5077596
29 30 31 32 33 34 35
0.5073270 0.5068943 0.5064616 0.5060289 0.5055962 0.5051635 0.5047308
36 37 38 39 40 41 42
0.5042981 0.5038653 0.5034326 0.5029999 0.5025671 0.5021344 0.5017016
43 44 45 46 47 48 49
0.5012689 0.5008361 0.5004033 0.4999706 0.4995378 0.4991051 0.4986723
50 51
0.4982396 0.4978068
{Warning} : It's actually rather difficult for mere mortals to determine which of the R-gods to believe on this one. I've learned so much R and statistics form each of those experts. I suspect there are matters of statistical concern or interpretation that I don't really understand.
If you look at the original Wordnet search and select "Display options: Show Lexical File Info", you'll see an extremely useful classification of words called lexical file. Eg for "filling" we have:
<noun.substance>S: (n) filling, fill (any material that fills a space or container)
<noun.process>S: (n) filling (flow into something (as a container))
<noun.food>S: (n) filling (a food mixture used to fill pastry or sandwiches etc.)
<noun.artifact>S: (n) woof, weft, filling, pick (the yarn woven across the warp yarn in weaving)
<noun.artifact>S: (n) filling ((dentistry) a dental appliance consisting of ...)
<noun.act>S: (n) filling (the act of filling something)
The first thing in brackets is the "lexical file". Unfortunately I have not been able to find a SPARQL endpoint that provides this info
The latest RDF translation of Wordnet 3.0 points to two things:
Talis SPARQL endpoint. Use eg this query to check there's no such info:
DESCRIBE <http://purl.org/vocabularies/princeton/wn30/synset-chair-noun-1>
W3C's mapping description. Appendix D "Conversion details" describes something useful: wn:classifiedByTopic.
But it's not the same as lexical file, and is quite incomplete. Eg "chair" has nothing, while one of the senses of "completion" is in the topic "American Football"
DESCRIBE <http://purl.org/vocabularies/princeton/wn30/synset-completion-noun-1> ->
<j.1:classifiedByTopic rdf:resource="http://purl.org/vocabularies/princeton/wn30/synset-American_football-noun-1"/>
The question: is there a public Wordnet query API, or a database, that provides the lexical file information?
Using the Python NLTK interface:
from nltk.corpus import wordnet as wn
for synset in wn.synsets('can'):
print synset.lexname
I don't think you can find it in the RDF/OWL Representation of WordNet. It's in the WordNet distribution though: dict/lexnames. Here is the content of the file as of WordNet 3.0:
00 adj.all 3
01 adj.pert 3
02 adv.all 4
03 noun.Tops 1
04 noun.act 1
05 noun.animal 1
06 noun.artifact 1
07 noun.attribute 1
08 noun.body 1
09 noun.cognition 1
10 noun.communication 1
11 noun.event 1
12 noun.feeling 1
13 noun.food 1
14 noun.group 1
15 noun.location 1
16 noun.motive 1
17 noun.object 1
18 noun.person 1
19 noun.phenomenon 1
20 noun.plant 1
21 noun.possession 1
22 noun.process 1
23 noun.quantity 1
24 noun.relation 1
25 noun.shape 1
26 noun.state 1
27 noun.substance 1
28 noun.time 1
29 verb.body 2
30 verb.change 2
31 verb.cognition 2
32 verb.communication 2
33 verb.competition 2
34 verb.consumption 2
35 verb.contact 2
36 verb.creation 2
37 verb.emotion 2
38 verb.motion 2
39 verb.perception 2
40 verb.possession 2
41 verb.social 2
42 verb.stative 2
43 verb.weather 2
44 adj.ppl 3
For each entry of dict/data.*, the second number is the lexical file info. For example, this filling entry contains the number 13, which is noun.food.
07883031 13 n 01 filling 0 002 # 07882497 n 0000 ~ 07883156 n 0000 | a food mixture used to fill pastry or sandwiches etc.
It can be done through MIT JWI (MIT Java Wordnet Interface) a Java API to query Wordnet. There's a topic in this link showing how to implement a java class to access lexicographic
This is what worked for me,
Synset[] synsets = database.getSynsets(wordStr);
ReferenceSynset referenceSynset = (ReferenceSynset) synsets[i];
int lexicalCode =referenceSynset.getLexicalFileNumber();
Then use above table to deduce "lexnames" e.g. noun.time
If you're on Windows, chances are it is in your appdata, in the local directory. To get there, you will want to open your file browser, go to the top, and type in %appdata%
Next click on roaming, and then find the nltk_data directory. In there, you will have your corpora file. The full path is something like:
C:\Users\yourname\AppData\Roaming\nltk_data\corpora
and lexnames will present under
C:\Users\yourname\AppData\Roaming\nltk_data\corpora\wordnet.