• WSkarinathomas

    WSkarinathomas

    @wskarinathomas

    Viewing 15 replies - 1 through 15 (of 38 total)
    Author
    Replies
    • in reply to: WordPerfect Viewer (Office 2003) #901542

      Hi Phil and John,

      Thanks for the product reference, I’ll check this out. I seemed to recall WordPerfect having a viewer, but noticed that it was strangely missing from their website, so I’m glad there is an alternative…bummer it’s not free though ! At any rate, we would prefer to use a viewer like this rather than Word’s viewers because we need the document to look as it did when it was originally created, and as we all know, Word’s converters won’t do that for us.

      Thanks again, much appreciated!

    • in reply to: WordPerfect Viewer (Office 2003) #901543

      Hi Phil and John,

      Thanks for the product reference, I’ll check this out. I seemed to recall WordPerfect having a viewer, but noticed that it was strangely missing from their website, so I’m glad there is an alternative…bummer it’s not free though ! At any rate, we would prefer to use a viewer like this rather than Word’s viewers because we need the document to look as it did when it was originally created, and as we all know, Word’s converters won’t do that for us.

      Thanks again, much appreciated!

    • in reply to: Getting the UNC path for a file (VBA Word 2003) #897143

      Thanks John, that’s great! I’m playing around with it now, I’m sure this will solve my dilemna!

    • in reply to: Getting the UNC path for a file (VBA Word 2003) #897144

      Thanks John, that’s great! I’m playing around with it now, I’m sure this will solve my dilemna!

    • in reply to: Saving defaults to Normal.dot (VBA Word 2003) #897053

      Thanks all for your input. In the end I decided to use the following code (provided by Helmut on another forum):

      Dim oDot As Document
      Set oDot = Documents.Open(strUserTemplateDir & Application.PathSeparator & pcNormal, Visible:=False)
      With oDot
      .PageSetup.LeftMargin = InchesToPoints(1)
      .PageSetup.RightMargin = InchesToPoints(1)
      .Styles(wdStyleNormal).Font.Name = “Times New Roman”
      .Styles(wdStyleNormal).Font.Size = 12
      .Save
      .Close
      End With

      Ultimately I wanted to modify the user’s Normal.dot to set their defaults, when they invoke it (i.e., click a button). I originally wanted to do it using the equivalent of the ‘Default’ button in Page Setup, Font and Language dialog boxes, mainly so that I wouldn’t have to open the Normal.dot, because I didn’t want the user to see the Normal.dot opened and closed. Helmut’s code provided the perfect solution, which opens the Normal.dot to edit it, and doesn’t make it visible to the user. Not surprising that the original code I was trying to use, which was from the Word VBA Help, didn’t do what it was supposed to!

    • in reply to: Saving defaults to Normal.dot (VBA Word 2003) #897054

      Thanks all for your input. In the end I decided to use the following code (provided by Helmut on another forum):

      Dim oDot As Document
      Set oDot = Documents.Open(strUserTemplateDir & Application.PathSeparator & pcNormal, Visible:=False)
      With oDot
      .PageSetup.LeftMargin = InchesToPoints(1)
      .PageSetup.RightMargin = InchesToPoints(1)
      .Styles(wdStyleNormal).Font.Name = “Times New Roman”
      .Styles(wdStyleNormal).Font.Size = 12
      .Save
      .Close
      End With

      Ultimately I wanted to modify the user’s Normal.dot to set their defaults, when they invoke it (i.e., click a button). I originally wanted to do it using the equivalent of the ‘Default’ button in Page Setup, Font and Language dialog boxes, mainly so that I wouldn’t have to open the Normal.dot, because I didn’t want the user to see the Normal.dot opened and closed. Helmut’s code provided the perfect solution, which opens the Normal.dot to edit it, and doesn’t make it visible to the user. Not surprising that the original code I was trying to use, which was from the Word VBA Help, didn’t do what it was supposed to!

    • in reply to: Saving defaults to Normal.dot (VBA Word 2003) #896271

      Thanks Howard. I understand that standard new documents are based on Normal.dot. I would rather not have to open the user’s Normal.dot to do this, especially when the code I am trying to use is ‘supposed to’, according to VBA Help, save the settings to the attached template, basically doing the equivalent of clicking the Default button in a dialog box like File, Page Setup.

      I don’t think AutoNew macros are going to work for what we are trying to achieve, which is basically that the user can click a button on their toolbar (so it is self-invoked) which will in turn set a number of our corporate ‘standard’ defaults in their Normal.dot for them. We want them to be able to do this if they choose (hence they run it from a button), and we are coding it so that they don’t have to ‘know’ the standards and do them one at a time on their own. We are setting the language, margins, font, and copying in our standard styles. The language setting works fine, and copying the standard styles to Normal.dot works fine. But the .SetAsTemplateDefault for the l/r margins is not working.

    • in reply to: Saving defaults to Normal.dot (VBA Word 2003) #896272

      Thanks Howard. I understand that standard new documents are based on Normal.dot. I would rather not have to open the user’s Normal.dot to do this, especially when the code I am trying to use is ‘supposed to’, according to VBA Help, save the settings to the attached template, basically doing the equivalent of clicking the Default button in a dialog box like File, Page Setup.

      I don’t think AutoNew macros are going to work for what we are trying to achieve, which is basically that the user can click a button on their toolbar (so it is self-invoked) which will in turn set a number of our corporate ‘standard’ defaults in their Normal.dot for them. We want them to be able to do this if they choose (hence they run it from a button), and we are coding it so that they don’t have to ‘know’ the standards and do them one at a time on their own. We are setting the language, margins, font, and copying in our standard styles. The language setting works fine, and copying the standard styles to Normal.dot works fine. But the .SetAsTemplateDefault for the l/r margins is not working.

    • in reply to: Sorting Information in a RecordSet (Word 2003 VBA) #877250

      Elvis (aka Rory) you’re beautiful!!! kiss
      Thank you SO much! It works wonderfully!

    • in reply to: Sorting Information in a RecordSet (Word 2003 VBA) #877251

      Elvis (aka Rory) you’re beautiful!!! kiss
      Thank you SO much! It works wonderfully!

    • in reply to: Sorting Information in a RecordSet (Word 2003 VBA) #876578

      Bummer, no, I tried it and it still stops on .Sort and gives me the ‘Invalid use of property’ error when I compile. Is it possible that I need a reference of some sort? I didn’t think so, but I’m grasping at straws now!

    • in reply to: Sorting Information in a RecordSet (Word 2003 VBA) #876579

      Bummer, no, I tried it and it still stops on .Sort and gives me the ‘Invalid use of property’ error when I compile. Is it possible that I need a reference of some sort? I didn’t think so, but I’m grasping at straws now!

    • I managed to get it to work, but only if I place the code in the user form, not if I call it. Obviously something needs to be public, but I’m not sure what. I tried making the rs variable public, but that didn’t do it. I’m shooting in the dark here. The code I have now in the user form is as follows:

      Private Sub GetUserList()
      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:

      Set oRoot = GetObject(“LDAP://rootDSE”)
      ‘Work in the default domain
      sDomain = oRoot.Get(“defaultNamingContext”)
      Set oDomain = GetObject(“LDAP://” & sDomain)
      sBase = “”
      ‘Get record set
      sFilter = “(&(objectCategory=person)(objectClass=user)(extensionattribute1=*))”
      sAttribs = “cn,distinguishedName,extensionattribute1,givenName,sn,MiddleName,Title,PersonalTitle,telephoneNumber,mail,Initials,Department,Division,physicalDeliveryOfficeName,Description”
      sDepth = ADS_SCOPE_SUBTREE

      sQuery = sBase & “;” & sFilter & “;” & sAttribs & “;” & sDepth

      conn.Open “Data Source=Active Directory Provider;Provider=ADsDSOObject”

      Set rs = conn.Execute(sQuery)

      rs.MoveFirst
      While Not rs.EOF
      cboAuthor.AddItem rs.Fields(2).Value
      rs.MoveNext
      Wend

      ErrHandler:

      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 Sub

    • I managed to get it to work, but only if I place the code in the user form, not if I call it. Obviously something needs to be public, but I’m not sure what. I tried making the rs variable public, but that didn’t do it. I’m shooting in the dark here. The code I have now in the user form is as follows:

      Private Sub GetUserList()
      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:

      Set oRoot = GetObject(“LDAP://rootDSE”)
      ‘Work in the default domain
      sDomain = oRoot.Get(“defaultNamingContext”)
      Set oDomain = GetObject(“LDAP://” & sDomain)
      sBase = “”
      ‘Get record set
      sFilter = “(&(objectCategory=person)(objectClass=user)(extensionattribute1=*))”
      sAttribs = “cn,distinguishedName,extensionattribute1,givenName,sn,MiddleName,Title,PersonalTitle,telephoneNumber,mail,Initials,Department,Division,physicalDeliveryOfficeName,Description”
      sDepth = ADS_SCOPE_SUBTREE

      sQuery = sBase & “;” & sFilter & “;” & sAttribs & “;” & sDepth

      conn.Open “Data Source=Active Directory Provider;Provider=ADsDSOObject”

      Set rs = conn.Execute(sQuery)

      rs.MoveFirst
      While Not rs.EOF
      cboAuthor.AddItem rs.Fields(2).Value
      rs.MoveNext
      Wend

      ErrHandler:

      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 Sub

    • Here I am…stumped again. I have pulled out a recordset from AD, and now I am trying to populate a combobox with the displayName field. I can get it to print to the Immediate window just fine, but not add the item to the combobox…

      Private Sub UserForm_Initialize()
      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:

      Set oRoot = GetObject(“LDAP://rootDSE”)
      sDomain = oRoot.Get(“defaultNamingContext”)
      Set oDomain = GetObject(“LDAP://” & sDomain)
      sBase = “”
      sFilter = “(&(objectCategory=person)(objectClass=user)(displayName=Thomas, K*))”
      sAttribs= “cn,distinguishedName,displayName,givenName,sn,MiddleName,Title,PersonalTitle,telephoneNumber,mail,Initials,Department,Division,physicalDeliveryOfficeName,Description”
      sDepth = ADS_SCOPE_SUBTREE
      sQuery = sBase & “;” & sFilter & “;” & sAttribs & “;” & sDepth
      conn.Open “Data Source=Active Directory Provider;Provider=ADsDSOObject”
      Set rs = conn.Execute(sQuery)

      rs.MoveFirst
      While Not rs.EOF
      For i = 0 To rs.RecordCount
      frmUserForm1.cboAuthor.AddItem rs.Fields(2).Value
      Next ‘i
      rs.MoveNext
      Wend

      rs.Close

      ErrHandler:

      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 Sub

      Any ideas?

    Viewing 15 replies - 1 through 15 (of 38 total)