Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: String text in Word html. Passing info between Word and Excel

  1. #11
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,422
    Rep Power
    10
    https://www.excelfox.com/forum/showthread.php/2348-String-text-in-Word-html-Passing-info-between-Word-and-Excel?p=15643&viewfull=1#post15643




    Word File Save As ___.htm



    At this stage, I would like to check what happens in terms of produced files and folders for some different files

    The OP’s file
    _ as he gave it, named 2. KEEP DUPLICATE RECORDS.docx
    _ name changed to 2_ KEEP DUPLICATE RECORDS.docx
    _ name changed to the Office 97 – 2003 format 2_ KEEP DUPLICATE RECORDS.doc
    _ the file with all images removed
    _ the file with everything removed

    _ a new virgin file


    I will do all that programmatically, for convenience and consistency since I might repeat the experiment in different Excel versions. ( So far most of my work is in Office 2007 )


    As a prelude to that, to help get some syntaxes, I will do some of that manually first, whilst running a macro recorder

    This is approximately what the macro recorder gave me. I have simplified it a bit and added some 'comments

    Code:
    Sub Makro7()
    '
    ' Makro7 Makro   https://excelfox.com/forum/showthread.php/2348-Just-Testing-Passing-info-between-Word-and-Excel?p=15643&viewfull=1#post15643
    '
    '  OPs  original file
        ChangeFileOpenDirectory "F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\"
        Documents.Open Filename:="""2. KEEP DUPLICATE RECORDS.docx""", ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", Format:=wdOpenFormatAuto, XMLTransform:="", DocumentDirection:=wdLeftToRight
        ChangeFileOpenDirectory "F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\Original OP File\"
        ActiveDocument.SaveAs Filename:="2. KEEP DUPLICATE RECORDS.docx", FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveDocument.SaveAs Filename:="2. KEEP DUPLICATE RECORDS.htm", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveWindow.View.Type = wdWebView
        ActiveDocument.Close ' close the  .htm file
        
    '  OPs file with dot in name changed to underscore
        RecentFiles(3).Open
        ChangeFileOpenDirectory "F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\Ops File with dot in name changed to underscore\"
        ActiveDocument.SaveAs Filename:="2_ KEEP DUPLICATE RECORDS.docx", FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveDocument.SaveAs Filename:="2_ KEEP DUPLICATE RECORDS.htm", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveWindow.View.Type = wdWebView
        ActiveDocument.Close  ' close the  .htm file
        
    ' File in Office 97 - 2003 format
        RecentFiles(3).Open
        ChangeFileOpenDirectory "F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\Ops file in 97 -2003 format\"
        ActiveDocument.SaveAs Filename:="2_ KEEP DUPLICATE RECORDS.doc", FileFormat:=wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveDocument.SaveAs Filename:="2_ KEEP DUPLICATE RECORDS.htm", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveWindow.View.Type = wdWebView
        ActiveDocument.Close ' close the  .htm file
        
    ' Ops file no images
        RecentFiles(3).Open
        Selection.MoveDown Unit:=wdLine, Count:=6
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.MoveDown Unit:=wdLine, Count:=2
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.MoveDown Unit:=wdLine, Count:=4
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.MoveDown Unit:=wdLine, Count:=4
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.MoveDown Unit:=wdLine, Count:=4
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.MoveDown Unit:=wdLine, Count:=2
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.TypeBackspace
        ChangeFileOpenDirectory "F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\Ops File no images\"
        ActiveDocument.SaveAs Filename:="2. KEEP DUPLICATE RECORDS no images.docx", FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveDocument.SaveAs Filename:="2. KEEP DUPLICATE RECORDS no images.htm", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveWindow.View.Type = wdWebView
        ActiveDocument.Close ' close the  .htm file
    
    ' Empty OP file
        RecentFiles(3).Open
        Selection.WholeStory
        Selection.TypeBackspace
        ChangeFileOpenDirectory "F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\OPs file empty\"
        ActiveDocument.SaveAs Filename:="2. KEEP DUPLICATE RECORDS empty.docx", FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveDocument.SaveAs Filename:="2. KEEP DUPLICATE RECORDS empty.docx", FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveDocument.SaveAs Filename:="2. KEEP DUPLICATE RECORDS empty.htm", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveWindow.View.Type = wdWebView
        ActiveDocument.Close  ' close the  .htm file
    
    '  Virgin file
        Documents.Add Template:="Normal", NewTemplate:=False, DocumentType:=0 ' make file
        ChangeFileOpenDirectory "F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\Virgin empty file\"
        ActiveDocument.SaveAs Filename:="Dok2.docx", FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveDocument.SaveAs Filename:="Dok2.htm", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveWindow.View.Type = wdWebView
        ActiveDocument.Close  ' close the  .htm file
    End Sub
    Here is the files produced

    ' OPs original file



    ' OPs file with dot in name changed to underscore


    ' File in Office 97 - 2003 format


    ' Ops file no images


    ' Empty OP file


    ' Virgin file






    We seem to have some inconstancy with the files and folders produced by the original OP macro, ( https://excelfox.com/forum/showthrea...ll=1#post15623 ) , so in the next post I had better check that first..
    The inconstancy seems to be that a .htm file was not produced – instead some strange file was there , one with no extension shown, and the new file folder produced did not have the full name 2. KEEP DUPLICATE RECORDS-Files , instead it came out as 2-Files
    2_ KEEP DUPLICATE RECORDS_docx gices these files when saved as _htm.JPG2_ KEEP DUPLICATE RECORDS_docx gives these files when saved as _htm.JPG
    Last edited by DocAElstein; 07-09-2023 at 03:53 PM.

  2. #12
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,422
    Rep Power
    10
    https://www.excelfox.com/forum/showthread.php/2348-String-text-in-Word-html-Passing-info-between-Word-and-Excel?p=21212&viewfull=1#post21212


    Word File Save As ___.htm



    At this stage, I would like to check what happens in terms of produced files and folders for some different files

    The OP’s file
    _ as he gave it, named 2. KEEP DUPLICATE RECORDS.docx
    _ name changed to 2_ KEEP DUPLICATE RECORDS.docx
    _ name changed to the Office 97 – 2003 format 2_ KEEP DUPLICATE RECORDS.doc
    _ the file with all images removed
    _ the file with everything removed

    _ a new virgin file


    I will do all that programmatically, for convenience and consistency since I might repeat the experiment in different Excel versions. ( So far most of my work is in Office 2007 )


    As a prelude to that, to help get some syntaxes, I will do some of that manually first, whilst running a macro recorder

    This is approximately what the macro recorder gave me. I have simplified it a bit and added some 'comments

    Code:
    Sub Makro7()
    '
    ' Makro7 Makro   https://excelfox.com/forum/showthread.php/2348-Just-Testing-Passing-info-between-Word-and-Excel?p=15643&viewfull=1#post15643
    '
    '  OPs  original file
        ChangeFileOpenDirectory "F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\"
        Documents.Open Filename:="""2. KEEP DUPLICATE RECORDS.docx""", ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", Format:=wdOpenFormatAuto, XMLTransform:="", DocumentDirection:=wdLeftToRight
        ChangeFileOpenDirectory "F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\Original OP File\"
        ActiveDocument.SaveAs Filename:="2. KEEP DUPLICATE RECORDS.docx", FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveDocument.SaveAs Filename:="2. KEEP DUPLICATE RECORDS.htm", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveWindow.View.Type = wdWebView
        ActiveDocument.Close ' close the  .htm file
        
    '  OPs file with dot in name changed to underscore
        RecentFiles(3).Open
        ChangeFileOpenDirectory "F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\Ops File with dot in name changed to underscore\"
        ActiveDocument.SaveAs Filename:="2_ KEEP DUPLICATE RECORDS.docx", FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveDocument.SaveAs Filename:="2_ KEEP DUPLICATE RECORDS.htm", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveWindow.View.Type = wdWebView
        ActiveDocument.Close  ' close the  .htm file
        
    ' File in Office 97 - 2003 format
        RecentFiles(3).Open
        ChangeFileOpenDirectory "F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\Ops file in 97 -2003 format\"
        ActiveDocument.SaveAs Filename:="2_ KEEP DUPLICATE RECORDS.doc", FileFormat:=wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveDocument.SaveAs Filename:="2_ KEEP DUPLICATE RECORDS.htm", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveWindow.View.Type = wdWebView
        ActiveDocument.Close ' close the  .htm file
        
    ' Ops file no images
        RecentFiles(3).Open
        Selection.MoveDown Unit:=wdLine, Count:=6
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.MoveDown Unit:=wdLine, Count:=2
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.MoveDown Unit:=wdLine, Count:=4
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.MoveDown Unit:=wdLine, Count:=4
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.MoveDown Unit:=wdLine, Count:=4
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.MoveDown Unit:=wdLine, Count:=2
        Selection.TypeBackspace
        Selection.TypeBackspace
        Selection.TypeBackspace
        ChangeFileOpenDirectory "F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\Ops File no images\"
        ActiveDocument.SaveAs Filename:="2. KEEP DUPLICATE RECORDS no images.docx", FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveDocument.SaveAs Filename:="2. KEEP DUPLICATE RECORDS no images.htm", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveWindow.View.Type = wdWebView
        ActiveDocument.Close ' close the  .htm file
    
    ' Empty OP file
        RecentFiles(3).Open
        Selection.WholeStory
        Selection.TypeBackspace
        ChangeFileOpenDirectory "F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\OPs file empty\"
        ActiveDocument.SaveAs Filename:="2. KEEP DUPLICATE RECORDS empty.docx", FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveDocument.SaveAs Filename:="2. KEEP DUPLICATE RECORDS empty.docx", FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveDocument.SaveAs Filename:="2. KEEP DUPLICATE RECORDS empty.htm", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveWindow.View.Type = wdWebView
        ActiveDocument.Close  ' close the  .htm file
    
    '  Virgin file
        Documents.Add Template:="Normal", NewTemplate:=False, DocumentType:=0 ' make file
        ChangeFileOpenDirectory "F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\Virgin empty file\"
        ActiveDocument.SaveAs Filename:="Dok2.docx", FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveDocument.SaveAs Filename:="Dok2.htm", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
        ActiveWindow.View.Type = wdWebView
        ActiveDocument.Close  ' close the  .htm file
    End Sub
    Here is the files produced

    ' OPs original file



    ' OPs file with dot in name changed to underscore


    ' File in Office 97 - 2003 format


    ' Ops file no images


    ' Empty OP file


    ' Virgin file






    We seem to have some inconstancy with the files and folders produced by the original OP macro, ( https://excelfox.com/forum/showthrea...ll=1#post15623 ) , so in the next post I had better check that first..
    The inconstancy seems to be that a .htm file was not produced – instead some strange file was there , one with no extension shown, and the new file folder produced did not have the full name 2. KEEP DUPLICATE RECORDS-Files , instead it came out as 2-Files
    2_ KEEP DUPLICATE RECORDS_docx gices these files when saved as _htm.JPG2_ KEEP DUPLICATE RECORDS_docx gives these files when saved as _htm.JPG
    Last edited by DocAElstein; 07-09-2023 at 03:52 PM.

  3. #13
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,422
    Rep Power
    10
    https://www.excelfox.com/forum/showthread.php/2348-String-text-in-Word-html-Passing-info-between-Word-and-Excel?p=15644&viewfull=1#post15644



    We seem to have some inconstancy with the files and folders produced by the original OP macro, ( https://excelfox.com/forum/showthrea...ll=1#post15623 ) , and those in the last post, so I will look into that here.
    The inconstancy seems to be that a .htm file was not produced by the original OP macro– instead some strange file was there , one with no extension shown, and the new file folder produced did not have the full name 2. KEEP DUPLICATE RECORDS-Files , instead it came out as 2-Files
    2_ KEEP DUPLICATE RECORDS_docx gices these files when saved as _htm.JPG2_ KEEP DUPLICATE RECORDS_docx gives these files when saved as _htm.JPG


    I had a little play around, and it looks I have tracked down the problem.
    To demo:-
    The following macro doers three Save As .htm code lines. The first does something similar to the original OP’s
    The second has replaced the first _ . _ in the file name with a _ _ _
    The final code line does the code line what the macro recorder gave.

    Looking at the three results, it is obvious what’s probably going on: The missing .htm in the OP’s code line is causing the problem. Although we are saving as FileFormat:=wdFormatHTML , it gets no extension on the file name.
    Without knowing exactly how Microsoft organised the working things, I cannot say exactly what is going on, but then file shown with no extension is clearly the htm file – we can prove this by opening with word, and it appears exactly the same as any of the 2. KEEP DUPLICATE RECORDS.htm files that we have been producing. The little discrepancy fact that the folder containing the images gets a name like 2-xxxx instead of like 2-2. KEEP DUPLICATE RECORDS xxxx , is probably because the workings are somehow mistaking the first _ . _ as the extension _ . _.
    That discrepancy does not appear when we replace the _ . _ with some other character, as in the second Save As .htm code line
    In fact, we also get a normal .htm extension as well. So this suggests that the workings are somehow confusing that first _ . _ as meaning that the extension is _ KEEP DUPLICATE RECORDS


    So the conclusion is:
    Most important you should add the .htm extension on the given file name.
    It is probably good practice to not have an extra _ . _ in any file name


    Results:
    ActiveDocument.SaveAs FileName:=strPath & "Temp1" & "" & "2. KEEP DUPLICATE RECORDS", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:= True


    ActiveDocument.SaveAs FileName:=strPath & "Temp2" & "" & "2_ KEEP DUPLICATE RECORDS", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False


    ActiveDocument.SaveAs FileName:=TempFolder & "" & "2. KEEP DUPLICATE RECORDS.htm", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False ', EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False



    Code:
    Sub OPsFileMakesStrangeFiles()  '   https://excelfox.com/forum/showthread.php/2348-Just-Testing-Passing-info-between-Word-and-Excel?p=15644&viewfull=1#post15644
    Dim strPath As String: Let strPath = "F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\"
     Documents.Open Filename:="F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\2. KEEP DUPLICATE RECORDS.docx" ' This wont error if document file is already open
      
        If Dir(strPath & "Temp1", vbDirectory) = "" Then MkDir strPath & "Temp1"
     ActiveDocument.SaveAs Filename:=strPath & "Temp1" & "\" & "2. KEEP DUPLICATE RECORDS", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=True
     ActiveDocument.Close
        
     Documents.Open Filename:="F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\2. KEEP DUPLICATE RECORDS.docx" ' This wont error if document file is already open
        If Dir(strPath & "Temp2", vbDirectory) = "" Then MkDir strPath & "Temp2"
     ActiveDocument.SaveAs Filename:=strPath & "Temp2" & "\" & "2_ KEEP DUPLICATE RECORDS", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False
     ActiveDocument.Close
     
     Documents.Open Filename:="F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\2. KEEP DUPLICATE RECORDS.docx" ' This wont error if document file is already open
        If Dir(strPath & "Temp3", vbDirectory) = "" Then MkDir strPath & "Temp3"
     ActiveDocument.SaveAs Filename:=TempFolder & "\" & "2. KEEP DUPLICATE RECORDS.htm", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False ', EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
     ActiveDocument.Close
    End Sub
    Last edited by DocAElstein; 07-09-2023 at 03:54 PM.

  4. #14
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,422
    Rep Power
    10
    https://www.excelfox.com/forum/showthread.php/2348-String-text-in-Word-html-Passing-info-between-Word-and-Excel?p=21213&viewfull=1#post21213




    We seem to have some inconstancy with the files and folders produced by the original OP macro, ( https://excelfox.com/forum/showthrea...ll=1#post15623 ) , and those in the last post, so I will look into that here.
    The inconstancy seems to be that a .htm file was not produced by the original OP macro– instead some strange file was there , one with no extension shown, and the new file folder produced did not have the full name 2. KEEP DUPLICATE RECORDS-Files , instead it came out as 2-Files
    2_ KEEP DUPLICATE RECORDS_docx gices these files when saved as _htm.JPG2_ KEEP DUPLICATE RECORDS_docx gives these files when saved as _htm.JPG


    I had a little play around, and it looks I have tracked down the problem.
    To demo:-
    The following macro doers three Save As .htm code lines. The first does something similar to the original OP’s
    The second has replaced the first _ . _ in the file name with a _ _ _
    The final code line does the code line what the macro recorder gave.

    Looking at the three results, it is obvious what’s probably going on: The missing .htm in the OP’s code line is causing the problem. Although we are saving as FileFormat:=wdFormatHTML , it gets no extension on the file name.
    Without knowing exactly how Microsoft organised the working things, I cannot say exactly what is going on, but then file shown with no extension is clearly the htm file – we can prove this by opening with word, and it appears exactly the same as any of the 2. KEEP DUPLICATE RECORDS.htm files that we have been producing. The little discrepancy fact that the folder containing the images gets a name like 2-xxxx instead of like 2-2. KEEP DUPLICATE RECORDS xxxx , is probably because the workings are somehow mistaking the first _ . _ as the extension _ . _.
    That discrepancy does not appear when we replace the _ . _ with some other character, as in the second Save As .htm code line
    In fact, we also get a normal .htm extension as well. So this suggests that the workings are somehow confusing that first _ . _ as meaning that the extension is _ KEEP DUPLICATE RECORDS


    So the conclusion is:
    Most important you should add the .htm extension on the given file name.
    It is probably good practice to not have an extra _ . _ in any file name


    Results:
    ActiveDocument.SaveAs FileName:=strPath & "Temp1" & "" & "2. KEEP DUPLICATE RECORDS", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:= True


    ActiveDocument.SaveAs FileName:=strPath & "Temp2" & "" & "2_ KEEP DUPLICATE RECORDS", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False


    ActiveDocument.SaveAs FileName:=TempFolder & "" & "2. KEEP DUPLICATE RECORDS.htm", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False ', EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False



    Code:
    Sub OPsFileMakesStrangeFiles()  '   https://excelfox.com/forum/showthread.php/2348-Just-Testing-Passing-info-between-Word-and-Excel?p=15644&viewfull=1#post15644
    Dim strPath As String: Let strPath = "F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\"
     Documents.Open Filename:="F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\2. KEEP DUPLICATE RECORDS.docx" ' This wont error if document file is already open
      
        If Dir(strPath & "Temp1", vbDirectory) = "" Then MkDir strPath & "Temp1"
     ActiveDocument.SaveAs Filename:=strPath & "Temp1" & "\" & "2. KEEP DUPLICATE RECORDS", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=True
     ActiveDocument.Close
        
     Documents.Open Filename:="F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\2. KEEP DUPLICATE RECORDS.docx" ' This wont error if document file is already open
        If Dir(strPath & "Temp2", vbDirectory) = "" Then MkDir strPath & "Temp2"
     ActiveDocument.SaveAs Filename:=strPath & "Temp2" & "\" & "2_ KEEP DUPLICATE RECORDS", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False
     ActiveDocument.Close
     
     Documents.Open Filename:="F:\Excel0202015Jan2016\ExcelFox\Word\prkhan56\2. KEEP DUPLICATE RECORDS.docx" ' This wont error if document file is already open
        If Dir(strPath & "Temp3", vbDirectory) = "" Then MkDir strPath & "Temp3"
     ActiveDocument.SaveAs Filename:=TempFolder & "\" & "2. KEEP DUPLICATE RECORDS.htm", FileFormat:=wdFormatHTML, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False ', EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
     ActiveDocument.Close
    End Sub
    Last edited by DocAElstein; 07-09-2023 at 03:55 PM. Reason: https://www.excelfox.com/forum/showthread.php/2348-String-text-in-Word-html-Passing-info-between-Word-and-Excel?p=21213&viewf

  5. #15
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,422
    Rep Power
    10
    https://www.excelfox.com/forum/showthread.php/2348-String-text-in-Word-html-Passing-info-between-Word-and-Excel?p=15645&viewfull=1#post15645









    upload pictures




    test

    Hi
    Mein Deutsch nicht so gut ist, da ich Engländer bin, aber ich werde es versuchen...
    Dies hängt mit einigen anderen ungelösten Dingen zusammen ( https://www.dsl-forum.de/threads/251...line-verbunden
    https://telekomhilft.telekom.de/t5/T...s/td-p/5342695 )
    Seit etwa einem Monat funktioniert meine Internetverbindung nicht mehr. Anfangs dachte man, es könnte ein Problem mit meinem alten Speedport W504V-Router sein.
    Ich war daran interessiert, weiter zu experimentieren, um diesen Verdacht zu bestätigen.

    Die Ergebnisse sind etwas seltsam:

    Ich habe noch ein paar andere Speedport W504Vs bekommen, die normal funktionierten, vor sie nicht mehr benutz, bzw. nicht mehr gebraucht war, und auch ein neues originalverpacktes, das nie benutzt wurde.
    Sie weisen alle das gleiche Problem auf wie ursprünglich bei meinem alten Speedport W504V: Sie verbinden sich alle erfolgreich, gehen online, aber das Internet funktioniert nicht und sie antworten weder auf 192.168.2.1 noch auf https://speedport.ip in der Adressleiste
    Hier sind typische Ergebnisse einer erfolgreichen Verbindung für eine direkte LAN-Kabelverbindung:
    https://i.postimg.cc/8CKFTQzM/Speedp...-LAN-Kable.jpg
    und hier sind typische Ergebnisse für eine erfolgreiche WLAN-Verbindung
    https://i.postimg.cc/fRsSKfPt/First-...-Connected.jpg
    https://i.postimg.cc/FRYYRWYq/First-...ssel-Geben.jpg
    https://i.postimg.cc/TYgWg4tv/First-...-Connected.jpg
    https://i.postimg.cc/VNLryLmz/First-...ed-working.jpg
    Aber danach bekommt man kein funktionierendes Internet, und beim IP 192.168.2.1 oder https://speedport.ip in die Adresszeile eingebe, kommt nur "Fehler: Netzwerk-Zeitüberschreitung - Der Server unter speedport.ip braucht zu lange, um eine Antwort zu senden." Egal mit welchem Browser oder Computer

    Das Überprüfen von Dingen wie ipconfig usw. bestätigt alle Gateway 192.168.2.1, wie es für den Speedport erwartet wird

    Der ganz neue Speedport reagierte bei der ersten Verbindung etwas anders, wie es sich gehört: Ein neuer Speedport bewirkt ein anfängliches Öffnen eines Browser-Tabs direkt beim anfänglichen Einrichtungsvorgang:
    https://i.postimg.cc/CMJGdtrP/New-Sp...connection.jpg
    https://i.postimg.cc/Xq2dhGyS/New-Sp...re-warning.jpg
    https://i.postimg.cc/7hPSmMhn/New-Sp...figuration.jpg

    Aber das scheitert beim ersten Schritt: Ich tippe hier das richtige Passwort ein, aber ich bekomme eine Fehlermeldung und komme nicht weiter.
    https://i.postimg.cc/FRVjynrK/New-Sp...t-Password.jpg


    Was das Ganze noch seltsamer macht, ist, dass ich einige alte Speedport W723s habe und sie alle normal funktionieren, mir ein funktionierendes Internet geben und auch wie erwartet reagieren, wenn sie 192.168.2.1 oder https://speedport.ip in die Adressleiste eingeben

    Andere Router, die ich habe, funktionieren auch normal.

    Ich habe meine Experimente mit vielen verschiedenen Computern mit unterschiedlichen Betriebssystemen wiederholt und die Ergebnisse sind immer gleich.

    Es ist nicht möglich, dass alle meine Speedport W504v kaputt sind. Ich gehe davon aus, dass sie alle so funktionieren, wie sie ursprünglich entwickelt wurden.
    Es scheint, dass etwas Seltsames passiert ist, so dass kein Speedport W504V mehr funktioniert???

    Habe die Telekom eine grundlegende Änderung vorgenommen, wonach ein Speedport W504V nun nie mehr funktioniert???


    Alan
    Direct link for forum
    [url=https://postimages.org/][img]https://i.postimg.cc/QC7swWy4/Here-Excel-forum-colors-ohne-rand.jpg[/img][/url]

    [url=https://postimages.org/][img]https://i.postimg.cc/7PJxfpZ3/Here-Excel-fox-colors-ohne-rand.jpg[/img][/url]

    now change link to post imagers to the link you want it to got to

    or

    Hello Chris, ( and Stuart )
    In Excel things occasionally go out of whack in my VB Editor and I am buggered if I can ever find a way to get them back normally using any conventional method. Usually the docking of windows getting corrupted has been to blame.
    So far the sledgehammer approach explained has always put the VB Editor back to normal for me.
    ( In case that old post link does not work, or they insist on you logging in and you don’t want to, I just put a copy of that post for you )

    ( you might need to look at a slightly different path in the registry. Someone else said they found it here: Computer\HKEY_CURRENT_USER\Software\Microsoft\VBA\ 7.1\Common

    Alan
    Last edited by DocAElstein; 07-09-2023 at 03:59 PM.

  6. #16
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,422
    Rep Power
    10
    https://www.excelfox.com/forum/showthread.php/2348-String-text-in-Word-html-Passing-info-between-Word-and-Excel?p=21214&viewfull=1#post21214









    upload pictures




    test

    Hi
    Mein Deutsch nicht so gut ist, da ich Engländer bin, aber ich werde es versuchen...
    Dies hängt mit einigen anderen ungelösten Dingen zusammen ( https://www.dsl-forum.de/threads/251...line-verbunden
    https://telekomhilft.telekom.de/t5/T...s/td-p/5342695 )
    Seit etwa einem Monat funktioniert meine Internetverbindung nicht mehr. Anfangs dachte man, es könnte ein Problem mit meinem alten Speedport W504V-Router sein.
    Ich war daran interessiert, weiter zu experimentieren, um diesen Verdacht zu bestätigen.

    Die Ergebnisse sind etwas seltsam:

    Ich habe noch ein paar andere Speedport W504Vs bekommen, die normal funktionierten, vor sie nicht mehr benutz, bzw. nicht mehr gebraucht war, und auch ein neues originalverpacktes, das nie benutzt wurde.
    Sie weisen alle das gleiche Problem auf wie ursprünglich bei meinem alten Speedport W504V: Sie verbinden sich alle erfolgreich, gehen online, aber das Internet funktioniert nicht und sie antworten weder auf 192.168.2.1 noch auf https://speedport.ip in der Adressleiste
    Hier sind typische Ergebnisse einer erfolgreichen Verbindung für eine direkte LAN-Kabelverbindung:
    https://i.postimg.cc/8CKFTQzM/Speedp...-LAN-Kable.jpg
    und hier sind typische Ergebnisse für eine erfolgreiche WLAN-Verbindung
    https://i.postimg.cc/fRsSKfPt/First-...-Connected.jpg
    https://i.postimg.cc/FRYYRWYq/First-...ssel-Geben.jpg
    https://i.postimg.cc/TYgWg4tv/First-...-Connected.jpg
    https://i.postimg.cc/VNLryLmz/First-...ed-working.jpg
    Aber danach bekommt man kein funktionierendes Internet, und beim IP 192.168.2.1 oder https://speedport.ip in die Adresszeile eingebe, kommt nur "Fehler: Netzwerk-Zeitüberschreitung - Der Server unter speedport.ip braucht zu lange, um eine Antwort zu senden." Egal mit welchem Browser oder Computer

    Das Überprüfen von Dingen wie ipconfig usw. bestätigt alle Gateway 192.168.2.1, wie es für den Speedport erwartet wird

    Der ganz neue Speedport reagierte bei der ersten Verbindung etwas anders, wie es sich gehört: Ein neuer Speedport bewirkt ein anfängliches Öffnen eines Browser-Tabs direkt beim anfänglichen Einrichtungsvorgang:
    https://i.postimg.cc/CMJGdtrP/New-Sp...connection.jpg
    https://i.postimg.cc/Xq2dhGyS/New-Sp...re-warning.jpg
    https://i.postimg.cc/7hPSmMhn/New-Sp...figuration.jpg

    Aber das scheitert beim ersten Schritt: Ich tippe hier das richtige Passwort ein, aber ich bekomme eine Fehlermeldung und komme nicht weiter.
    https://i.postimg.cc/FRVjynrK/New-Sp...t-Password.jpg


    Was das Ganze noch seltsamer macht, ist, dass ich einige alte Speedport W723s habe und sie alle normal funktionieren, mir ein funktionierendes Internet geben und auch wie erwartet reagieren, wenn sie 192.168.2.1 oder https://speedport.ip in die Adressleiste eingeben

    Andere Router, die ich habe, funktionieren auch normal.

    Ich habe meine Experimente mit vielen verschiedenen Computern mit unterschiedlichen Betriebssystemen wiederholt und die Ergebnisse sind immer gleich.

    Es ist nicht möglich, dass alle meine Speedport W504v kaputt sind. Ich gehe davon aus, dass sie alle so funktionieren, wie sie ursprünglich entwickelt wurden.
    Es scheint, dass etwas Seltsames passiert ist, so dass kein Speedport W504V mehr funktioniert???

    Habe die Telekom eine grundlegende Änderung vorgenommen, wonach ein Speedport W504V nun nie mehr funktioniert???


    Alan
    Direct link for forum
    [url=https://postimages.org/][img]https://i.postimg.cc/QC7swWy4/Here-Excel-forum-colors-ohne-rand.jpg[/img][/url]

    [url=https://postimages.org/][img]https://i.postimg.cc/7PJxfpZ3/Here-Excel-fox-colors-ohne-rand.jpg[/img][/url]

    now change link to post imagers to the link you want it to got to

    or

    Hello Chris, ( and Stuart )
    In Excel things occasionally go out of whack in my VB Editor and I am buggered if I can ever find a way to get them back normally using any conventional method. Usually the docking of windows getting corrupted has been to blame.
    So far the sledgehammer approach explained has always put the VB Editor back to normal for me.
    ( In case that old post link does not work, or they insist on you logging in and you don’t want to, I just put a copy of that post for you )

    ( you might need to look at a slightly different path in the registry. Someone else said they found it here: Computer\HKEY_CURRENT_USER\Software\Microsoft\VBA\ 7.1\Common

    Alan
    Last edited by DocAElstein; 07-09-2023 at 04:00 PM.

  7. #17
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,422
    Rep Power
    10
    https://www.excelfox.com/forum/showthread.php/2348-String-text-in-Word-html-Passing-info-between-Word-and-Excel?p=15646&viewfull=1#post15646





    _.______________
    Here

    Here

    ExcelFox


    ExcelFox


    Here


    Here

    Code:
    https://www.excelforum.com/excel-programming-vba-macros/343845-docking-project-explorer-vertically.html#post4545938


    https://i.postimg.cc/9Rf6XHnm/Here-link-Bild.jpg[/img]


    _.____________________

    _.______________
    vorschor bild for forum


    _.__________________________-
    direct link for forum complete
    or 0r
    Now change link to postimages.org to the link you want it to go to
    or or
    Last edited by DocAElstein; 07-09-2023 at 04:00 PM.

  8. #18
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,422
    Rep Power
    10
    https://www.excelfox.com/forum/showthread.php/2348-String-text-in-Word-html-Passing-info-between-Word-and-Excel?p=21215&viewfull=1#post21215





    _.______________
    Here

    Here

    ExcelFox


    ExcelFox


    Here


    Here

    Code:
    https://www.excelforum.com/excel-programming-vba-macros/343845-docking-project-explorer-vertically.html#post4545938


    https://i.postimg.cc/9Rf6XHnm/Here-link-Bild.jpg[/img]


    _.____________________

    _.______________
    vorschor bild for forum


    _.__________________________-
    direct link for forum complete
    or 0r
    Now change link to postimages.org to the link you want it to go to
    or or
    Last edited by DocAElstein; 07-09-2023 at 04:02 PM.

  9. #19
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,422
    Rep Power
    10
    Last edited by DocAElstein; 07-09-2023 at 06:54 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  10. #20
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,422
    Rep Power
    10
    https://www.excelfox.com/forum/showthread.php/2348-String-text-in-Word-html-Passing-info-between-Word-and-Excel?p=21217&viewfull=1#post21217
    Last edited by DocAElstein; 07-09-2023 at 04:10 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

Similar Threads

  1. Replies: 1
    Last Post: 04-02-2019, 03:04 PM
  2. Export data (text) Excel to Ms Word Format
    By muhammad susanto in forum Excel Help
    Replies: 0
    Last Post: 10-06-2017, 09:36 AM
  3. Replies: 7
    Last Post: 08-24-2015, 10:58 PM
  4. VBA How to pass formatted text from Excel to MS Word
    By johnweber in forum Excel Help
    Replies: 2
    Last Post: 03-01-2015, 08:41 PM
  5. Replies: 1
    Last Post: 10-16-2012, 01:53 PM

Posting Permissions

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