Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    FileSaveAs 'fix' causes problem with conversion (Win 98 / Word 97 (both Dutch))

    I replaced the standard FileSaveAs with my own Sub FileSaveAs. Basically it checks first if the document is based on a company template and, if so, fills some fields and then returns handling to Word. Originally with Dialogs(wdDialogFileSaveAs).Show. But due to a issue with Password to Open I changed that according to http://www.mvps.org/word/FAQs/MacrosVBA/Sa...ordsContent.htm to:
    With Dialogs(wdDialogFileSaveAs)
    If .Display = -1 Then
    strFileName = .Name
    .Update
    .Name = strFileName
    .Execute
    End If
    End With

    (The other workaround in the same article doesn't work.)

    But this workaround appeared to cause another problem. Whe the user chooses to save as Textdocument in the Save as dialog, the document is saved as MyDoc.txt allright, but the content is still a Word document!
    Replace the workaround with the original code and the conversion to TXT file does it's job again.
    So I seem to be stuck between the devil and the deep blue see. Unless someone has onother workaround that solves both problems...

    Thanks
    JanB

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: FileSaveAs 'fix' causes problem with conversion (Win 98 / Word 97 (bot

    Hmmm... what is this .Update of which you speak?

    Judging from the code: store the file name, .Update, then re-educate the dialog as to the file name, using .Update flushes everything that was there. So you're going to have to capture and restore the SaveAs format, too. Maybe like this:

    <pre>Dim strFileName As String, lngFormat As Long
    With Dialogs(wdDialogFileSaveAs)
    If .Display = -1 Then
    strFileName = .Name
    lngFormat = .Format
    .Update
    .Name = strFileName
    .Format = lngFormat
    .Execute
    End If
    End With</pre>

    Hope this helps. Just in case you wonder what else you might be losing, help lists these parameters: "Name, Format, LockAnnot, Password, AddToMru, WritePassword, RecommendReadOnly, EmbedFonts, NativePictureFormat, FormsData, SaveAsAOCELetter, WriteVersion, VersionDesc"

  3. #3
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FileSaveAs 'fix' causes problem with conversion (Win 98 / Word 97 (bot

    Thanks for your input, Jefferson, that does the trick!
    I looked for something along that line, but could not find a suitable property for the dialog panel. And when I placed the dot and "f" after Dialogs(wdDialogFileSaveAs) there was no Format property in the list. A hidden feature?

    JanB

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: FileSaveAs 'fix' causes problem with conversion (Win 98 / Word 97 (bot

    IntelliSense doesn't know about the specific arguments for dialogs, only the generic ones. You can look up the specific arguments in the online help for Word VBA, they are listed under something like "Built-in Dialog Box Argument Lists". Unfortunately, only the names of the arguments are listed, without explanation or example.

  5. #5
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FileSaveAs 'fix' causes problem with conversion (Win 98 / Word 97 (bot

    Thanks Hans! I found the help item you were referring to. <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>

    JanB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •