|
Please don't repost, but rather edit the original question. It helps in terms of readability if blocks of code are wrapped in PRE -tags.
henkbongers wrote: I send by email a word document to a person. I would like an answer from that person. therefore I want to make a command button in that word document. the action should be: the person answers the question in the word document clicks on the command button and the word document is send to my emailadres.
Dude, that's not a coding-question, that's simply the description of the desired functionality. Either task someone with coding this for you, or ask a specific question.
henkbongers wrote: information why the code I have used don't work.
You didn't state "why" it didn't work. Is it the security-warning that's unacceptable?
I are Troll
|
|
|
|
|
henkbongers wrote: .AddRecipient "blabla@.nl"
thats not valid for starters.
a domain that starts with a period infers locally in the dns, localhost (i think, don't quote me, been a while!)
|
|
|
|
|
Thanks for the 1 vote, for stating fact! i.e. blabla@.nl doesn't have a valid domain name.
|
|
|
|
|
+5, since it's a valid comment, aimed towards solving the problem.
Just to add to the pile of comments; there's not only a security-warning from Outlook - I expect that Word will also show a warning on opening the document, asking whether or not to enable macro's or something similar.
I are Troll
|
|
|
|
|
What version of word are you using? i have 2007, and it doesn't work either.
there appears to be changes to the availability of the objects depending on versions, i.e. they still show up in the object model, but you cannot use them.
I wasn't aware of this and having a look at the moment what the alternates are.
|
|
|
|
|
Ok,
There is other code to use, just tried it.
ActiveDocument.SendForReview "a.user@the-domain.com", "Your Question Answered", False, True
You still get a trust dialog, saying the usual an application is trying to send a message, allow/deny. (This dialog is created by outlook, if you have different mail client setup as a default, i.e. do not have outlook, i don't know what happens).
So, the code works, it is just that outlook is trying to protect you from potentially unauthorised emails being sent.
The other option may be to use Outlook automation, but as you can tell this requires a bit more coding.
|
|
|
|
|
Hi Friends,
I am getting an error 2023 in range variable.
Set rFoundCell_Value = Range(rFoundCell.Address).Offset(0, 1)
in above rFOundCell is having range address as "A1"
As wanted to fetch the value of the next col to A1 i am using the above line.
I am not sure about this error.
Please Help.
Regards,
Priya.
|
|
|
|
|
|
Hi Dave,
Yes I am trying to set value to an range object..I have changed and working fine..
Thanks.
|
|
|
|
|
Hi,
Please help me this problem
I have these tables:
CommissariatTD(CommissariatID, comm_name,region, DeptID, Deptname)
DepartmentTD(DeptID, region, Deptname)
I have a form that binds to CommissariatTD_view where I do this:
a RegionCombobox with these items(North,south,east,west)
a DepartmentCombobox
CommissariatTD_view datagrid
Here is my problem:
let's say I select a region on the regioncombobox, it loads the record on the grid but on the departmentcombobox, nothing shows. I bind it with departmentbindingsource, selected value is from CommissariatTD_view--DeptID
it should load all departments for that region.
**Note we can have more than one department on a region......
if we have more than one dept. when select a dept. the grid should show only the commissariats for that department and region..
I am missing something now. Please guide me.
Thanks in advance
Best regard..
|
|
|
|
|
I don't understand the layout of your two tables. The fields 'region' and 'Deptname' appear in both tables and I'm guessing that they are never populated in CommissariatDT. You only need to have the field 'DeptID' common to both tables and do the join on that.
What SELECT statement are you using to create your view?
It’s not because things are difficult that we do not dare, it’s because we do not dare that things are difficult. ~Seneca
|
|
|
|
|
I like to make a command button in a word-document to submit email
|
|
|
|
|
|
henkbongers wrote: I like to make a command button in a word-document to submit email
Nobody's gonna stop you.
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
I created a macro that gets a list of elements (strings), puts them into an array, then creates an appropriate number of worksheets each named after an element in the array.
Everything works fine. However, occationally when dealing with this list of elements, they are arranged in a sort of list-sublist-evenmoresublist pattern, meaning that there is some variable number of whitespace in front of some of the elements.
I know this is fairly simple, I am not entirely new to the programming world, but I am new to vba in Excel and from prior experiences working with macros, there is a ton of built in functions that I am unaware of and they makes tasks like these pretty simple. (excuse the run-on )
Here is the block that handles my count elements/load into array (feel free to correct it if there is a simpler route):
'Count Elements, dimension element array to appropriate size
n = 7
eCount = 0
Do While Worksheets("Costs Incurred").Cells(n, 2) <> ""
If Worksheets("Costs Incurred").Cells(n, 2) <> "" Then
eCount = eCount + 1
End If
n = n + 1
Loop
ReDim elements(1 To eCount)
'Load Element names into Element Array
n = 1
Do While n <= eCount
elements(n) = Worksheets("Costs Incurred").Cells(n + 6, 2)
n = n + 1
Loop
Thanks for any help!
|
|
|
|
|
Why create an array to store the elements and then create the worksheets for the elements, do the whole lot at once.
use the isBlank() isEmpty() to test the cells contain no value and use that as a stop for the routine.
use the cell.value to get the text of the cell
use trim() to remove whitespace from the value before creating the worksheet with the name.
I am just away to footy, or i would knock up a routine, but have a go yourself first, and i should be back in 3ish hrs if you still stuck.
Cheers the noo,
[edit: changed isBlank to isEmpty]
Dave
Don't forget to rate messages!Find Me On: Web| Facebook| Twitter| LinkedInWaving? dave.m.auld[at]googlewave.com
modified on Thursday, July 15, 2010 6:26 PM
|
|
|
|
|
Ok, here is a sub that does wht you want;
Stick a button on the original form, and attach the code to it. Set the starting cell of the list of sheets you want to create.
Public Sub generateSheets()
Dim currentCell As Range
Set currentCell = ThisWorkbook.Sheets("Sheet1").Range("D5")
Dim cellValue As String
While Not IsEmpty(currentCell)
cellValue = Trim(CStr(currentCell.Value))
Dim newSheet As Worksheet
Set newSheet = ThisWorkbook.Sheets.Add(after:=Sheets.Item(Sheets.Count))
newSheet.Name = cellValue
Set currentCell = currentCell.offset(1, 0)
Wend
End Sub
|
|
|
|
|
hey... this may not be an answer to your question but I just noticed that the if statement that you have used is totally unnecessary! The program will work in the exactly same way without it!
|
|
|
|
|
Hi all,
I'm using a DataGrid from the WPFToolkit v3.5 and I'm trying to reapply a user-defined sort following a refresh of the DataGrid. To do this, I'm trying to store the DataGrid's SortDescriptionCollection in a local variable and then re-add the SortDescriptions once the DataGrid has been rebound.
My problem is that the local variable seems to be more of a pointer to the dtg.Items.SortDescriptions collection rather than a copy and is reset back to zero once the DataGrid is rebound.
Here's the code:
1. Dim complexSortDesc = Me.dtgComplexQueue.Items.SortDescriptions
2. Dim numComplex As Integer = PopulateComplex().Count
3. ApplyCustomSort(dtgComplexQueue, complexSortDesc)
4. UpdateQueueTitle(numComplex)
When line #1 is completed, I have a count of 2 SortDescription objects in complexSortDesc . After line #2 has run, complexSortDesc has a count of zero.
Here's the PopulateComplex fn:
Private Function PopulateComplex() As Requests
Dim complexRequests = New Requests(QueueType.Complex)
complexRequests.Sort(New DefaultSortByImportDateAndSurname)
dtgComplexQueue.ItemsSource = New TriageMenuDataMembers(complexRequests)
Return complexRequests
End Function
How can I get a copy of the SortDescriptionCollection so that the collection exists after the DataGrid has been rebound? I don't seem to have this problem in other areas of my app so I'm thinking it has something to do with the PopulateComplex fn..?
Thanks
|
|
|
|
|
I want to execute SQL Query within a Dataset. I don't know how it should be done.
I just have some sample Query & sample data.
Dim ds As New DataSet
ds.ReadXml("test.xml")
Here Is the test.xml File:
<?xml version="1.0" standalone="yes"?>
<DataSetSchema>
<Tab1>
<ID>1</ID>
<Name>abc</Name>
<Location>loca</Location>
</Tab1>
<Tab1>
<ID>2</ID>
<Name>ijk</Name>
<Location>locb</Location>
</Tab1>
<Tab1>
<ID>3</ID>
<Name>xyz</Name>
<Location>locc</Location>
</Tab1>
<Tab1>
<ID>4</ID>
<Name>uvw</Name>
<Location>locd</Location>
</Tab1>
</DataSetSchema>
|
|
|
|
|
A dataset returns a collection of DataTables, in this case it would only contain one Table. I don't think it is possible to query DataSets using SQL. You would need to iterate through the table until you found an ID matching 1 and retrieve the name. Personally I prefer to use XML literals and LinQ to retrieve data from xml files like this
Dim datatest As XDocument = XDocument.Load("Test.xml")
For Each student In From element In datatest...<Tab1>
If student...<ID>.Value = 1 Then
name = student...<Name>.Value
Exit For
End If
Next
MsgBox(Name)
That makes everything very concise and readable.
Hope this helps.
Happy Coding
|
|
|
|
|
Is that only one way to do quering a dataset?
I tried Dataset.Select("ID=1") but it is not enought for my requirement.
anyway thanks.
|
|
|
|
|
You could always bind the data to a bunch of controls e.g. bindingsource, bindingnavigator and datagridview and then use the FILTER property of the BindingSource, as it acts just like a 'where' clause in SQL.
Dave
Don't forget to rate messages!Find Me On: Web| Facebook| Twitter| LinkedInWaving? dave.m.auld[at]googlewave.com
modified on Thursday, July 15, 2010 10:10 AM
|
|
|
|
|
i have an examination system that will be run twice a year. some of the tables are setup some are transactional. should i archive or backup at end of each processing
|
|
|
|
|
yes, obviously.
|
|
|
|