• mvpjjf

    mvpjjf

    @mvpjjf

    Viewing 15 replies - 181 through 195 (of 208 total)
    Author
    Replies
    • in reply to: Get Name of Installed Font using API (Vb API) #544942

      First, that function doesn’t do what you think it does, and I don’t recall offhand what the right one is — I may be able to find it tomorrow.

      Jeff Prosise explained it this way:
      “When a Windows program draws to a screen, a printer, or another output device, it doesn’t communicate directly with the device as an MS-DOS program is apt to do. Rather, the Windows program draws to a logical “display surface” represented by a device context (DC). Deep inside Windows, a device context is a data structure containing fields that describe everything the GDI needs to know about the display surface and the context in which it is being used…”

      The following is from a C++ viewpoint. I’m not sure you can do the same thing in VB…

      You can make copies of a DC and modify them before displaying them. If your function receives a copy of a DC and needs to add some text to it, you may need to find out what face is already selected there. That’s what GetTextFace is for: you pass in the DC (actually a handle to the DC, hence hDC) and a buffer that can hold a string. The nCount parameter says how big the buffer is. When the function returns, the buffer contains the name of the selected font in the DC.

      The MS documentation is at http://msdn.microsoft.com/library/default….ontext_3jtx.asp, but again, that’s based on C++ and may be hard to apply to VB.

    • in reply to: Backgrounds for labels ? (Word 2000) #1788754

      Hi, Chris,

      Format/Background is only for Web pages. (You might notice that as soon as you assign a background, Word flips into Web view, and if you switch to Page Layout view the background disappears.) These backgrounds won’t print.

      First, to make things easier, go into Tools/Options and turn on display of paragraph marks and object anchors.

      Put the cursor in the paragraph that follows the table, and use Insert/Picture. It’ll come in as an in-line graphic, on a second page. On the Picture toolbar, click the Wrapping button and select Behind Text.

      Drag the picture to cover one label and size it to fit. (It will keep trying to get away from you hairout but drag it back carefully, and spit on it razz to make it stay put.) If the anchor jumps into the table, drag it back to the final paragraph mark. (If the picture is anchored in a table cell, it interferes with the alignment of text in the cell.)

      Click the Image Control button on the Picture toolbar and select Watermark. If that makes it too washed-out, fiddle with the Less Brightness and More Contrast buttons until you like it.

      Hold down Ctrl and drag the picture to the other cell, and play games again until it’s positioned in the cell and anchored outside the table.

      Finally, add your text and print the labels.

    • in reply to: Dotted Border increases file size (97 / 2000) #544297

      In Word 2000, the file grows from 20KB to “only” 397KB with the small dashes, 262KB with the large dashes, and 149KB with the dot-dash line. hairy

    • in reply to: Inverted Text (Word 2000 SR-1) #544295

      To expand on this a bit… Set up the merge main document as a landscape page, with the vertical alignment set to Center. Insert a 1-row x 2-column table. Right-click one cell of the table, choose Text Direction, and rotate the text clockwise. Do the same to rotate the other cell counterclockwise. Now put in the merge fields.

    • in reply to: Write to the registry (VB6 / NT4) #544078

      There may be an easier way in VB, but I haven’t found it. hairout The Win32API way works, but it’s complicated. Put this behind a command button, run it, and then look at the Explorer key in RegEdit.

      Const ERROR_SUCCESS = 0&
      Const HKEY_LOCAL_MACHINE = &H80000002
      Const REG_SZ = 1                         ' Unicode nul terminated string
      Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" _
          (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
      Private Declare Function RegCloseKey Lib "advapi32.dll" _
          (ByVal hKey As Long) As Long
      Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" _
          (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, _
          ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
          ' Note that if you declare the lpData parameter as String,
          ' you must pass it By Value.
          
      Private Sub Command1_Click()
          Dim nRet As Long, hKey As Long
          Dim SubKey As String, ValName As String, ValValue As String
          
          SubKey = "SoftwareMicrosoftWindowsCurrentVersionExplorer"
          ValName = "Demonstration"
          ValValue = "My string value"
          
          nRet = RegOpenKey(HKEY_LOCAL_MACHINE, SubKey, hKey)
          If (ERROR_SUCCESS = nRet) Then
              nRet = RegSetValueEx(hKey, ValName, 0&, REG_SZ, ByVal ValValue, _
                  Len(ValValue) + 1)
              If (ERROR_SUCCESS  nRet) Then
                  MsgBox "SetValue failed."
              End If
              RegCloseKey (hKey)
          Else
              MsgBox "SetValue failed."
          End If
          Unload Me
      End Sub
    • in reply to: Using ALT key to select a block (Word 2000 ) #543933

      That’s what I do, too. But if block select worked in the VBE, I wouldn’t have to do a two-step shuffle. Surely MS knows that programmers are the laziest folk on the face of the planet — we’ll work all day to avoid two extra keystrokes! hairy

    • in reply to: Find and replace (using wildcards) (97) #543932

      When all else fails, use the ASCII value of the character. For a backslash, that’s ^92. fanfare

    • in reply to: Using ALT key to select a block (Word 2000 ) #543640

      Sometimes I grab a chunk of code out of the quoted section of a newsgroup post, and it has > signs all down the left margin. My newsreader doesn’t support block select, so the code still has that garbage when I paste it into the VBA editor. Instant mass syntax error! razz

      It’s fairly easy to get rid of the junk with F&R, but block select would be quicker and easier.

    • There’s no adjustment I’m aware of. These fields are pretty primitive, as I don’t think this part of the code has been touched in 10 years. razz The spacing is probably a fixed percentage of the font size, since it always seems to clear the descenders by the same visual space.

      BTW, I discovered a limitation while I was playing with it: The text in the parentheses can’t contain a comma. That’s because EQ fields use the comma as a parameter separator. Including a comma makes the field interpreter think you have two parameters, but the x switch only accepts one parameter.

      In W2K, in the Help topic on the EQ field, go to the subsection on the x switch and click the button to see the four options to, bo, le, and ri. They aren’t independent switches, just options for the x switch.

    • in reply to: Macro Help! – PageWidth Setting (Word 2000 SR-1) #543445

      Hi, Rich,

      I just tried it (I’m also using Word 2000 SR-1) and it works fine for me. I tried declaring vPageWidth both as a String and as a Single (which is what the Help topic for .PageWidth says it returns)… same result. For an 8.5″ Letter page, for instance, I get 612, which is 8.5 inches * 72 points/inch.

      Maybe your printer driver is returning some funny results to Word? shrug

    • One more possibility: Use an EQ field with the x (box) switch and the bo (bottom only) qualifier…

      {eq xbo(Your text here)}

      Works in any version of Word, all the way back to 2.0 and maybe earlier. evilgrin

      A possible drawback is that the line extends a point or two to the left and right of the text, since it’s part of an enclosing box. Your choice.

    • in reply to: Document File Size, Too Big for So Little (Word 97 SR2) #542987

      At the risk of heading seriously off-topic, the “minimum file block” (MS calls it “cluster size”) isn’t that big — it’s between 4KB and 32KB for a FAT32-formatted partition, as explained at http://www.pcguide.com/ref/hdd/file/partFAT32-c.html.

      Yes, 19KB is the minimum file size for a Word 97/2000 document (and I expect the same for 2002, since it uses the same file structure). It takes that much just to set up the “containers” that you put text, graphics, formatting, tables, document information, comments, and all the other junk into.

      If disk space is a significant worry to you, use a compression program like WinZip. Word documents scrunch down to fairly small percentages of their original size. smash

    • in reply to: Using ALT key to select a block (Word 2000 ) #542980

      It most assuredly is in Word 2000. I just used it a minute ago. What ticks me off is that it doesn’t work in the VBA editor. shrug

    • in reply to: Always open in normal view (Word 2000 SR2; NT4) #542979

      I’ll assume that you mean the attorney wants to see Normal view whenever he opens a document, and not that he wants to force other people to open his documents in Normal view. (I never underestimate the arrogance of an attorney evilgrin, but the latter would be a really bad idea.)

      Put this macro in the attorney’s Normal.dot, or in a template located in his Word Startup folder:

      Public Sub FileOpen()
         If Dialogs(wdDialogFileOpen).Show = -1 Then
            ActiveDocument.ActiveWindow.View.Type = wdNormalView
         End If
      End Sub
      
    • in reply to: Adding all headings to a list box (VBA for Word 2000) #542977

      Pardon my stepping in here… hello

      Change the name of your procedure to Userform_Initialize, and it will work.

      The reason you weren’t getting anything in the listbox is that the procedure frmAppendixStartsat_Initialize() never executed. For reasons that aren’t clear to me, shrug Microsoft decreed that all events that belong to a userform — any userform, regardless of its name — are called Userform_XXXX(), not ActualUserformName_XXXX().

    Viewing 15 replies - 181 through 195 (of 208 total)