i hope this works Results

Page 49 of 50.
Results 961...980 of 2,409

Sponsored Links:

Hello, I'm writing some code that reads some user attributes out of Active Directory and populates a user form with the attribute values. Previously I have always done this by populating the user form with values from the Registry, so this is new to me. I have the code working to read all the attributes and just a particular attribute, and it runs just fine as long as it is not called from within the user form code. For example, the following sub works:

Public Sub test()
'gets the login ID of the logged in user, passes it to a public variable - works fine
'Parameters are the public var for the login ID, and the AD attr name; it returns public var sAttr which contains the value of the AD attr
basUserADInfo.GetUserAttr LoginUserName, "firstname"
MsgBox sAttr 'displays the value just fine
End Sub

The code which gets the attribute - basUserADInfo.GetUserAttr - follows below:

Public Function GetUserAttr(LoginName As String, sAttrib As String) As String
'PURPOSE: Display information that is available in the Active Directory about a given user

Dim conn As New ADODB.Connection
Dim rs As ADODB.Recordset
Dim oRoot As IADs
Dim oDomain As IADs
Dim sBase As String
Dim sFilter As String
Dim sDomain As String
Dim sAttribs As String
Dim sDepth As String
Dim sQuery As String
Dim user As IADsUser

On Error GoTo ErrHandler:

'Get user Using LDAP/ADO
Set oRoot = GetObject("LDAP://rootDSE")
'Work in the default domain
sDomain = oRoot.Get("defaultNamingContext")
Set oDomain = GetObject("LDAP://" & sDomain)
sBase = ""
'Only get user name requested
sFilter = "(&(objectCategory=person)(objectClass=user)(SAMac countName=" & LoginName & "))"
sAttribs = "ADsPath"
sDepth = "SubTree"
sQuery = sBase & ";" & sFilter & ";" & sAttribs & ";" & sDepth
conn.Open "Data Source=Active Directory Provider;Provider=ADsDSOObject"
Set rs = conn.Execute(sQuery)

If Not rs.EOF Then
Set user = GetObject(rs("ADsPath"))
With user
sAttr = user.Get(sAttrib)
End With
End If


On Error Resume Next
If Not rs Is Nothing Then
If rs.State 0 Then rs.Close
Set rs = Nothing
End If

If Not conn Is Nothing Then
If conn.State 0 Then conn.Close
Set conn = Nothing
End If

Set oRoot = Nothing
Set oDomain = Nothing

End Function

Now, the code I am using to populate the user form is:

Private Sub UserForm_Initialize()
Dim ctlText As Control
basUserADInfo.GetUserAttr LoginUserName, "firstname"
txtFirstName.Value = sAttr
End Sub

I actually had this setup so the basUserADInfo.GetUserAttr procedure was a function that returned the attribute value, so I could run the following code, which cycles through all my tagged controls (which are named the same as the AD attributes) and populates them:

For Each ctlText In Me.Controls
If ctlText.Tag "" Then
ctlText.Value = basUserADInfo.GetUserAttr(LoginUserName, ctlText.Tag)
End If
Set ctlText = Nothing

But, when that didn't work I started simplifying the code (to what I have at the top of this post) in an effort to figure out what wasn't working. Finally, I got the code so darn simplified, as you can see, and it works like a charm unless I try to call it from the user form...so I am at a loss.

I hope someone out there can point out what I am doing wrong. I just hate ending the day stuck!

Thanks to all you gurus,

The programmers at my company are plagued with issues related to the Package and Deployment Wizard. When writing an application and then creating an installation package, then trying to run this package on the server, EVERY SINGLE TIME it will announce it is copying files, then present you with an OK/Cancel window stating that the system needs to reboot (assumably to register the controls just copied). So you reboot the system and run the install again, it copies the same files, and again, presents you with the same window stating you have to reboot. This never ends. What we have been doing is using Regsvr32.exe to manually register the controls from a command line. For files that are in use we would reboot into a DOS mode, explicitly delete the file and copy in the new file (such as scrun.dll). We found one time that these copied files were stored in an obscure directory (system32msftpdw.something) so we wrote a program to loop all of the files and attempt to execute the regsvr32.exe on each. This worked for all files with the exception of the shared, of course.

Can't begin to tell you how time consuming and annoying this is - especially if you are deploying to several fat clients. I even called Microsoft Support who didn't identify it as any bug so they woud charge us for just searching the knowledge base and sending us the article. So, we declined their service and searched the KB ourselves (again) and didn't come up with anything.

Someone else out there must have run into this issue, and hopefully, has found a better way around this.


Sorry I have been away for a while, and now I can come up for some air and send a request not to shoot me first then read this second, but to the opposite.

OK my Boss is so proud of what he has done some 20 years ago, that there is no way I am going to convince him to let me upgrade the systems he has put in place.

In a routine task of looking at internal processes, we discovered that my Boss has written some QuickBASIC code that handles some sensitive issues that is still working on MS-DOS and Dot matrix printers. To be honest with you, I am quite impressed by what he did, some 20 years ago...

BUT!!! he is not going to let me touch it and move it into a VB or VBA version and I tried. There is a problem, and we need to fix the program so that it can do a form feed on a dot matrix printer.

Now I know that this is a huge deal, and maybe manually one will still get it wrong, but I was hoping to even allow the printer to reset say if someone counts the sprockets and then the code will rewind or forward by what ever it needs to print.

I printed a report, and it came out on half the page, because I did not know I had to reset the page to a certain position. This is where the problem came up, and my Boss is adamant on keeping his legacy alive...

So even if the answer is "can't do it" please let me know, maybe the preponderance of evidence will help him wise up.



I'm currently working as a temporary full-time employee for a company who has been a client of mine for almost 15 years. I'm hoping to have it turn into a full-time permanent position, but, right now, they don't have a position in the company for anyone to do what I do, basically custom application development in Office, automated templates and forms, training, integration with other applications and databases, Access database development, etc. I'm a Microsoft Office Specialist - Master Instructor as well as a VBA developer, and I think I have a lot to offer this company. However, I have to convince them of that. So I'm trying to put together documentation that will help sell the value of having someone around who can do this kind of work, one piece of which would be a potential job description. So, I'm looking for input from any of you who are doing this type of work full-time, or even part-time if it is an actual position and not just something you do in addition to your regular job because it's so much fun. If you have a job description, could you either post it (if you think others might find it of value) or send it to me directly? Thanks!

If you've been through something similar and have suggestions on how to approach the powers that be, I'd appreciate that input, too. And anything else you think might be helpful. This company just topped 500 employees, with offices all over, and their one VB programmer doesn't really deal with Office at all. Oh, and if you have any input on appropriate salary ranges, I'd appreciate having that information, too. This temporary position started March 1, for just this month, and so I need to get something put together quickly.

Many thanks!


Hi! I hope someone can help or point me in the right direction here. I am working on a vb app and I need to import a text file into the program(database) and I don't have a clue as to how to do this. My app has a database named layouts that contains 4 fields one of which is a part number field. I need to match that part number field up to the part number field in a text file (the text file is generated by a proprietary system and there's no other way of getting the info out.) and only display those matching records. (If theres a part number in the layouts database, I need only the matching records from the text file.)
The text file is a +-sign delimited file and the user needs to be able to press an Update button and have this file imported into the program and displayed in a table-like fashion or grid. The info in the text file is read only and does not need to be edited.
I am a vb newbie and really have no idea where to even begin on this. ALL help is VERY much appreciated! Thank You!

I'm looking to color half a cell (the left or the right side). I know there are tricks in Excel itself but as far as I've seen, nothing comes close to normal shading (and yes, I think I know this is easier with Excel 2007).

So, I'm thinking of doing with with VBA. No very complex I think... make a graphical element and align it to the cell left or right. Make the graphical element the same height and half as wide as the underlying cell, give it a color, remove the borders and bingo (I think and hope...).

Of course I can try and build this but quite frankly, I'm hoping that some code is already available that does this (or comes close)... someone must have done this before!

I'd appreciate any suggestions and will post back my working code here after I'm done.

Oh, by the way, I'd need to have a way to select a cell, and via worksheet.change event find if a graphical element is already there and either update or remove that... To be honest, if I think about it, that seems the more difficult part of the code: how do I identify a graphical element that is on top of the current cell?

Hi to all -- hope this makes some sense ....

I'm working on a project where a user will be sending an email with a special Subject line and possible text in the body of the email. The email will be read by an Outlook client, who (perhaps thru Outlook Rules) will cause any number of different VBScript programs to be executed. OK, no trouble so far ..... The trouble begins with the actual VBScript program. The code in certain scripts are accessing some areas of the network where higher network rights are needed. Since the VBScript is inheriting the rights of the Outlook client when running (this account has limited rights), the VBScript will error out on a rights access issue.

So, my question is: Can someone come up with a way in code that I can change the authentication access such that the VBScript program will complete OK? I do not want to give the Outlook client any kind of Supervisor access. I keep thinking there must be some way to do this ...... Any help or guidance is appreciated!

Oops -- environment is Win2K and Office2K.


Andrew Harrell
vb Padawan Learner

At times it is a nuisance that built-in styles (like Normal or heading 1) can't be renamed in Word.

Say you want to copy parts of one document into another with different style definitions, but want to keep the formatting. This is nearly impossible if both documents use built-in styles, because you can not rename the styles in one of the documents. So a paragraph formatted in Normal style will acquire the formatting of Normal in the document you paste into, and there is not much you can do about it (short of using "paste special" as a Word document object).

Another case where I found this a nuisance is when I take Word documents into a DTP program. Say the chapter headings in the DTP program are supposed to have style H1. Then I have to rename heading 1 in the DTP program, which often has to be done manually.
A macro solution in Word would be preferable.

The following macro renames all styles in the document by appending a * to the style name (heading 1 is changed to heading 1* ...).
Since heading 1* isn't recognized as a built-in style anymore, I can then rename it to anything I want (for example to H1).

The macro works by saving the file in RTF format, and changing all style names in the header of the RTF file.

Hope somebody else will find this useful, too.
The usual disclaimer: Use the macro at your own risk


Sub ChangeStyleNames()
' The macro appends a * to all style names
' It thus changes built-in styles to ordinary styles
Dim myRange As Range
Dim MsgText
Dim myFileName

MsgText = "Cancel if you have not saved the file"
If MsgBox(MsgText, vbExclamation + vbOKCancel, "Danger") = vbCancel Then
End If

myFileName = ActiveDocument.Name
If InStr(1, myFileName, ".") > 0 Then
myFileName = Left$(myFileName, InStr(1, myFileName, ".")) & "RTF"
myFileName = myFileName & ".RTF"
End If
ActiveDocument.SaveAs _
FileName:=myFileName, _
Documents.Open _
FileName:=myFileName, _
ConfirmConversions:=False, _
Set myRange = ActiveDocument.Content
myRange.Find.Execute _
FindText:="{stylesheet*}}", _
myRange.Find.Execute _
FindText:=";}", _
ReplaceWith:="*^&", _
MatchWildcards:=True, _
Documents.Open _
End Sub

Edited by dansy on 16-Aug-01 17:04.Hi,
hope someone can help with this as its driving me nuts.
I have a set of vba subs (see extract below) that open a directory and scans each file (opened read only) of a given mask for text of a given mask. Results are put into a new document for each source file with the .text element of the target find being pastespecial'd as a hyperlink in column 1 of the target document table row.

This works fine sometimes on the 3 test source files, sometimes processes 2 then bombs (error 5342) and sometimes only does the first file. The first file is always processed successfully and the target file it bombs on is successfully opened and the text found, the newdoc created and the table inserted, but fails on the first pastespecial with error 5342. This is because the ability to paste as a link is not available (in a newly created document!!) but I have no idea why. I have searched and searched for hits on 5342 to no avail.
Note that even when I stop the macro and go into the newdoc the Paste as Link option is not available. The target document is not protected.
Any help on this would be appreciated as I am tearing my hair out - and there aint much left to tear out!

Sub req_extract_main
Set fs = Application.FileSearch
With fs
.LookIn = "D:vba code tester"
.FileName = "abcd-*.doc"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
total_file_counter = .FoundFiles.Count
MsgBox "There were " & total_file_counter & _
" REK*.DOC file(s) found."
For i = 1 To .FoundFiles.Count
Documents.Open FileName:=.FoundFiles(i), ReadOnly:=True
Selection.HomeKey Unit:=wdStory ' Set pointer to start of doc
search_source = .FoundFiles(i) ' Set the source document to the first window
Set sourceDoc = Documents(.FoundFiles(i))
OpenNewDoc ' Create the target doc
ScanReq ' Scan the target and populate the New doc
Documents(.FoundFiles(i)).Close SaveChanges:=wdDoNotSaveChanges

Next i
MsgBox "There were no suitable files found."
End If
MsgBox "A total of " & total_file_counter & " files were searched of which, " & yes_file_counter & " had matching content."
End With
End Sub


Sub ScanReq()
With sourceDoc.ActiveWindow.Selection.Find
.Text = "[^#^#^#^#:^$^?:^#^#^#]" ' Set the search mask and find criteria
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
sourceDoc.ActiveWindow.Selection.Find.Execute ' Perform the find then assign vars to the
' results
If sourceDoc.ActiveWindow.Selection.Find.Found Then
With sourceDoc.ActiveWindow.Selection
found_text = .Text
found_sentence = .Sentences(1)
found_page = .Information(wdActiveEndPageNumber)
End With

With newDoc.ActiveWindow.Selection ' Check insertion point is in the table then
If .Information(wdWithInTable) = True Then ' add a row and paste the results
End If
found_counter = found_counter + 1
sourceDoc.ActiveWindow.Selection.Copy ' copy the .text portion so we can paste the link
Documents(newDoc).ActiveWindow.Selection.PasteSpec ial Link:=True, DataType:=wdPasteHyperlink
.MoveRight Unit:=wdCell, Count:=1
.Text = found_sentence
.MoveRight Unit:=wdCell, Count:=1
.Text = found_page
.MoveLeft Unit:=wdCell, Count:=2
End With
End If
Loop Until Selection.Find.Found = False
If found_counter > 0 Then ' We had at least one match so sort them
sort_results ' Sort the results
yes_file_counter = file_counter + 1
With newDoc
.SaveAs FileName:="Results of scan of " & Left(sourceDoc.Name, 9)
End With
Documents(newDoc).Close SaveChanges:=wdDoNotSaveChanges
End If
End Sub

It bombs on the first paste on the second file EVERY time now.

Hi, I'm new here, so I hope I've posted this in the right place!

I've converted a PFD file to Word. The file contains hundreds of hyperlinks that point to places in the same file. My problem is that these hyperlinks all point to the header of the target page, rather than the target itself - a result of the conversion.

So I firstly wrote a macro that finds all the headings and subheadings and converts them into bookmarks. This seems to work quite well, but not all the headings are picked up, even though they all have the same font. I then wrote a macro that took all the hyperlinks, compared them to the bookmarks, and if there was a match, stored the bookmark as the new subaddress of the hyperlink.

However, I don't seem to be able to get this second part working. I've never studied VBA before, so its all getting rather confusing for me! I was wondering if anyone could look at my code and tell me where I'm going wrong?

Sub GetBookmarks()

Dim SenRange As Range
Dim j As Integer
Dim Addy As String

On Error Resume Next
For Each SenRange In ActiveDocument.Sentences
If SenRange.Font.Name = "Helvetica" Then
SenRange.HighlightColorIndex = wdYellow
Addy = SenRange.text
Addy = Replace(Addy, " ", "_")
'MsgBox Addy
ActiveDocument.Bookmarks.Add Name:=Addy, Range:=SenRange

End If

End Sub

Sub ConvertHLinks()

Dim i As Integer
Dim HLinkName As String
Dim oBookmark As Bookmark
Dim oBookmarkName As String

For i = 1 To ActiveDocument.Hyperlinks.Count
HLinkName = ActiveDocument.Hyperlinks(i).TextToDisplay
HLinkName = Replace(HLinkName, " ", "_")
numWords = UBound(Split(HLinkName, " ")) + 1
HLinkName = Left(HLinkName, InStr(HLinkName, "(") - 2)

For Each oBookmark In ActiveDocument.Bookmarks
oBookmarkName = oBookmark.Name
If InStr(1, oBookmarkName, HLinkName, vbTextCompare) = 1 Then
MsgBox oBookmarkName
ActiveDocument.Hyperlinks(i).SubAddress = oBookmarkName

End If
Next oBookmark

End Sub

Many thanks, Oliver

This is my first post in this corner of the lounge, so I hope I'm not retreading old ground. I decided to use a set of PP slides as the basis for filling out a multipage A4 pre-printed form. I used images of the printed pages, scanned directly into PP and drew textboxes in the appropriate positions. Then I deleted the images and printed my text etc. directly onto the preprinted form.

It worked well for the most part, but the text (boxes) consistently needed to be dropped down by about 1 line height of 10pt Tahoma font, and shifted right by about 1 character width of the same font. I'm wondering if there's something I can do to ensure "perfect" alignment in the future, since this looks to be a useful general method of doing this kind of thing.


Hello everybody!

I've got a little problem (at least I hope it's little). First of all I have to explain I'm not a native speaker and am not working with the english but a german version. So it could be I don't know the correct technical terms to describe what I mean. Nevertheless I hope to make myself understood...
So here's the topic: I want to activate Macros on mouseclick on an object (s.th. like hyperlinks or starting another application). When I click the mousebutton I want a little graphic to pop up, and on another click to disappear again. All this should happen during the running presentation...
Is there the possibility to do s.th. like this? If so I would appreciate a little example.
I know that I could realize this example also by using animation settings, but this one is not the real idea, just an attempt to get accustomed to the general process.
Many thanks in advance!!

Hello, I have been trying to sync my Toshiba PDA using a USB cable and cradle with Outlook. Just downloaded ActiveSync 4 hoping this would resolve the problem. I keep getting the following msgs. "The command line argument is not valid. Verify the switch you are using". Then "ActiveSync. can not log on to Outlook. Make sure Outlook is installed and functioning properly (it is working fine)". Then "Synchronization can not be started because you are not able to log on to the network and access information. Restart computer and sync again or contact...". Has anyone had this problem and could you help me? I would very much appreciate it. Thank you, Tira

Good afternoon!

Just solved one problem, got the next!
I want to know if it's possible to edit the username.nk2 file.
Here's the situation: one of our employees has been working for a couple of weeks using another persons username. This other person is not coming back, and now is the replacement happy to use her own account again. Problem however is that the 'old' user has so many data in her *.nk2 file that the other one wants them too. BUT she doesn't want her own one to be replaced...
Can I just open the *.nk2 file with wordpad and copy the whole thing to the other user's *.nk2 file?

I hope to hear from you soon! (it's on behalf of the direction secretary

Many thanks in advance!

Bye bye,


A simple one I hope

I'm trying to set up a resource ("Boardroom") so that it can have a calendar and be invited to meetings.

What I want is
a) people to be able to scan its calendar
[img]/forums/images/smilies/cool.gif[/img] people to be able to invite it to meetings
c) most importantly, for it to auto acept, or auto reject the meeting request straight away (ideally from the server, not a client machine)

I can achieve a) & [img]/forums/images/smilies/cool.gif[/img] simply enough - but blowed if I can make c) work.

My questions
- is there a standard way to do this
- does a meeting room agent have to be logged in for replies to work

Does anyone know/recommend any online/web-based equivalents of Outlook? I've looked at various options like AOL/Yahoo's Calendars, but they fall down in their lack of support for tasks and contacts (e.g. AOL's address book, besides being very basic, isn't integrated with the calendar, exists only on the local machine, and isn't available via browser on another machine).

I've had to give up using netfolders for synching my personal home Outlook with work use. I'd love an Outlook PIM that I can access from anywhere. Hope this is the right part of the lounge to pitch this question. Thanks.

I just had my hard drive redone by our Help desk. In the process they upgraded me to Internet Explorer 6.0. The combination of 6.0 and XP causes me to be unable to reply to .html messages without Outlook crashing. (This is just plain Outlook, I'm not using Word as my editor.)

After much research we found a solution (Microsoft has not as yet). Search isn't working at WOPR now so I couldn't see if this had already been reported. I manually checked back 2 months and didn't find anything,

The solution, found in many places via Google! is to downgrade the MSHTML.DLL back to the previous version, specifically version 6.0.2800.1126. Once in place all problems disappear.

One thing that was not apparent from the internet was how to implement this as the .dll in question is always in use if Windows is running.

I understand there are other ways but left to my own devices, I rebooted to a DOS prompt with the following steps:

Shut down and select the Restart option
press F8 key as windows starts to start in Safe Mode
scroll to the "start from a DOS prompt" option
Type "CD Windowssystem32", no quotes on any typed info.
Type "rename mshtml.dll mshtml.old"
Type "copy c:mshtml.dll" (Note: I had loaded the correct version of the file onto my C: drive for convenience)
Type "CD Windowssystem32dllcache"
Type "rename mshtml.dll mshtml.old"
Type "copy c:mshtml.dll"

I then hit Ctrl+Alt+Delete to reboot and everything now works fine.

Hope this helps.


I have somehow managed to created additional .pst folders in Outlook and I cannot delete them. At present, I have my "working" folder with my name on it. I have a second folder (also with my name on) and two folders named Personal Folders. These folders contain Inbox, Outbox, Calendar, Contacts, etc.

This is very confusing. I have deleted all the information from these surplus folders but I cannot delete them or close them. When I right-click and choose "Close the Name Folder", I get a window saying "The operation failed. An Object cannot be found." I get the same message for all three surplus folders. I cannot chose Delete the Personal Folder because it is grayed out. I have some instructions from the Knowledge Base on deleting a .pst folder but my confusion lies in determining WHICH folder is my primary folder. I show four .pst folders and they have the same names. Two say Personal Folders and two say Barbara Folders. I cannot rename the unwanted folders; I have tried that already.

This problem spills over to my Calendar. When I choose to display the Calendar, there are two Calendars showing in the Navigation Pane. One named Calendar and one named Calendar My Name. The Calendar named with my name is my current Calendar but it is NOT the Calendar that display automatically. If I forget to check, I find I am entering appointments, etc. on the old Calendar. This confuses my little brain.

When I try to delete the surplus Calendar I get the attached message. Is there any hope for me?

I have always had great service from Woody's - let's hope this continues!

I am looking for a tag for my yahoo email. I think you call it a tag.
It lets you know when the person to whom you are sending an email, has opened the document.
It should be free and work with yahoo.

Can you also tell me what the American expression "no brainer" means.

Here are a few questions that I have about using the new Outlook program when I'm off campus:

(1) Is there any way to adjust the time so that I don't have to keep logging in after a 10-15 min.

time lapse away from my computer?

(2) Is there any way to delete or modify the "authentication" prompt for opening attachments which asks

to verify my password three times before it will open an attachment (I send a lot of attachments to


(3) I frequently have problems attaching documents when I use this program (I had this problem with

the old program, as well). Do you have any idea why the "browse" tab fails to click on to get

a file (this happens, less frequently, with the "attach" tab, as well)? When it works the tab will

click and remain depressed while I search for a file. When it does not work, it will not remain

depressed. This is actually a major problem for me.

(4) Is there any way to "unblock" the content for a newsletter that I receive once, sometimes

twice, a day, so that I don't have to unblock it when I receive each individual newsletter?

I hope that you can help me with some or all of these questions. Thanks a lot. Have a nice day!

Page 49 of 50.
Results 961...980 of 2,409