View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
[email protected] acampbell012@yahoo.com is offline
external usenet poster
 
Posts: 129
Default web Query with variable or cell value

Thanks. This worked perfectly. I am refreshing the query every time the
workbook is opened. The I.D. number is refreshed based on the
individual's network i.d. which I obtailn through a separate function.

NickHK wrote:
Depends how you are refreshing your web query.
From code:
querystr=http://MyCompany/apps/empname/get_emp_name.asp?empnum=" &
range("IDNumber").value

On a WS:
Look into "parameter query" from the Excel help.

NickHK

wrote in message
oups.com...
Hello again,

I am reposting to my original request for some help. One of my
company's web developers helped me (I think) with the problem in my
original post. However, I have another question I am hoping somebody
may be able to help me with.

The following link, placed in a web query, successfully retrieves the
employee name based on the I.D. (830598). However, this value needs to
change for each user that opens my spreadsheet. I have the employee ID
stored in a variable elsewhere in my spreadsheet for each user that
opens the workbook. However, I don't know how to programatically alter
this query to include that stored value in the query.

Any help would be greatly appreciated.

http://MyCompany/apps/empname/get_em...?empnum=830598


wrote:
Hi,

I am attempting to retrieve employee information from my company's web
site (employee directory). The web page uses frames (I think). Working
directly from the web page, you enter data on the form, select the
search field (eg. empl. name, ID, phone number, etc.) to return the
results.

I am attempting to retrieve the employee name based on the employee ID
which i already have stored as a variable in Excel.

I am getting better at coding in Excel, but this is new ground for me
and any help would be appreciated. I would like to bring the emloyee
name back to a cell within Excel.

I have pasted the code from the intranet "search frame" below.
Regardless of the search criteria, the search results are always listed
in a set order (e.g. name, id, phone, dept., etc.) Thanks in advance
for any responses.

Alan


<html
<head
<titleEmployee Directory</title
<LINK rel="stylesheet" type="text/css" href="/css/mycompany.css"
</head

<SCRIPT LANGUAGE="JavaScript"
<!--
var w2 = null;
function IHRISHelp(){
if (w2 != null)
w2.close();

w2=window.open("help.htm",
"Help","width=400,height=300,navbar=yes,resizable= yes");

}

function submitTheForm(){
if (document.form0.searchval.value.length 0) {
document.form0.submit();
}
}

function MainNumbers(){
if (w2 != null)
w2.close();
w2=window.open("mainnumbers/MainNumbers.htm",

"MainNumbers","width=600,height=350,scrollbars=yes ,menubar=yes,navbar=yes,re
sizable=yes");
}

function LeadershipTeamReport(){
if (w2 != null)
w2.close();
w2=window.open("LeadershipTeamReport/LeadershipTeamReport.xls",

"LeadershipTeamReport","width=600,height=350,scrol lbars=yes,menubar=yes,navb
ar=yes,resizable=yes");
}

function PrintEmployeeList(){
parent.EmployeeList.focus();
parent.EmployeeList.print();
}
//--
</SCRIPT

<body class="body5" onLoad="document.forms[0].searchval.focus();"


<h3Employee Directory</h3

<form method="POST" action="listingFrame.asp" target="EmployeeList"
name="form0"
<table border="0"

<tr
<tdSearch For:<input type="text" name="searchval" size="20"
onKeyUp="submitTheForm()"</td
<td align='left' valign='center'Search By:
<select name="Search_Field" size="1"
<option VALUE="Name"Name</option
<option VALUE="Empnum"Empl. Number</option
<option VALUE="Phone"Phone Extension</option
<option VALUE="Mail"Mail</option
<option VALUE="BusinessUnit"Organization</option
<option VALUE="Department"Department/Area</option
<option VALUE="Job"Job Title</option
<option VALUE="SupervisorName"Manager</option
<option VALUE="Phonetic"Phonetic Last Name</option
</SELECT</td
</tr</table
<table border="0" width="100%"
<tr
<td
<input type="submit" value="Search" name="Submit"&nbsp;
<input type="button" value="Print" name="Print"
onclick="PrintEmployeeList();"&nbsp;
<input type="submit" value="Export" name="Submit"&nbsp;
<!--<input type="button" value="Main Numbers" name="Main"
onclick="MainNumbers();"&nbsp;--
</td
</tr
</table
<input type="hidden" name="appType" value="full"
<hr
</form

</body