Page 20 of 61 FirstFirst ... 10181920212230 ... LastLast
Results 191 to 200 of 604

Thread: Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)

  1. #191
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10
    Some supporting notes for some other stuff...



    _3) Regarding the remaining leftover hide.me app on Windows 7 machine after I de- installed it
    ….( hide.me that was still showing in my program list after I had de installed, and note also that on restarting the windows 7 machine with the remaining left over hideme app, a hideme typically window came up , did something for a while, then another hide me window came up and offered me the chance to buy premium!! )
    Strange remaining hide me thing after de install.JPG : https://imgur.com/4HsLmDN
    Attachment 2439

    I tried the Revo Unistaller as suggested, http://revo-uninstaller.en.softonic.com/ .
    This was also not able to de install the hide.me that was still showing in my program list after I had de installed it: Revo also cannot de install the remaining hide.me.jpghttps://imgur.com/HY7pSIy
    After this failed attempt, I performed the scan that Revo offered.
    This scan took several hours. The scan first showed these left over registry things, Revo scan found left over hideme.jpg : https://imgur.com/r99WKN6
    Attachment 2440
    , which I chose to delete: Choose to delete found left over hideme.jpg , Deleting scan found left over hideme.jpg : https://imgur.com/aoToZJ2 , https://imgur.com/5jsACjQ .
    Then the following left over files and folders were also shown, Revo scan found left over hideme Files and Folders.jpg : https://imgur.com/78YKmd4
    Attachment 2441
    , which I also chose to delete: Choose to delete Revo scan found left over hideme Files and Folders.jpg , Deletingf Revo scan found left over hideme Files and Folders.jpg : https://imgur.com/VAlBzED , https://imgur.com/2YoSSML .
    Finally it appears that all left over hide.me files are gone: hideme no longer listed in programs.jpg : https://imgur.com/9aentWL
    A restart is said to remove some files, .. Revo says remainig files will be deleted by restart.jpg : https://imgur.com/QTjDtf1 , so I restarted.
    It seemed at this stage, ( after a restart) that the hideme app was completely removed.

  2. #192
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10
    In support of answers to these Threads:
    http://www.excelfox.com/forum/showth...ified-email-id
    https://stackoverflow.com/questions/...75857_58525487
    https://stackoverflow.com/questions/...-be-sent-to-sm
    https://stackoverflow.com/questions/...-less-and-less






    Register an account with Freemail German Telekom, for use with CDO.Message Send program

    Login / Register

    https://www.t-online.de/
    Login.JPG : https://imgur.com/n5aLakd
    https://accounts.login.idm.telekom.c...nse_type=code#
    ht[color==#417394]tps://accounts.login.idm.telekom.com/oauth2/auth?client_id=10LIVESAM30000004901PORTAL000000000 00000&state=d725154dc1fc296807eda1341546636892fc9739ccb7 5d714dc2c89b4159148e&claims=%7B%22id_token%22%3A%7B%22urn%3Atelekom.com %3Aall%22%3Anull%7D%7D&nonce=d725154dc1fc296807eda1341546636892fc9739ccb7 5d714dc2c89b4159148e&redirect_uri=https%3A%2F%2Flogin.t-online.de%2Fcallback&display=popup&scope=openid&response_type=code#[/color]

    Registrieren.JPG : https://imgur.com/J6nnDm2
    https://meinkonto.telekom-dienste.de...nt/index.xhtml
    https://meinkonto.telekom-dienste.de...erstatus.xhtml

    UserStatus.jpg : https://imgur.com/IqjhWop

    New Email Address
    New Email Address.jpg : https://imgur.com/zH2G73c

    Register
    Register.JPG : https://imgur.com/570UkbH
    https://imgur.com/D6vRwex
    You will probably be sent a number code via SMS to your Telephine number. , https://imgur.com/eBpabq5 ,

  3. #193
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10
    In support to answer of this Thread:
    http://www.excelfox.com/forum/showth...ll=1#post11557

    _____ Workbook: VBA.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    1
    1234
    2
    5678
    3
    91011
    4
    12131415
    5
    1617181920
    Worksheet: abc
    'match column A of abc sheet with column A of def sheet
    ' if it matches then delete that data in column A of def
    ' "match column A of abc sheet with column A of def sheet if it matches then delete that data in column A of def"

    _____ Workbook: VBA.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    1
    1234
    2
    15678
    3
    191011
    4
    112131415
    5
    16171811920
    after the process completed delete all the data in this sheet
    Worksheet: def
    _____ Workbook: VBA Exampled.xls ( Using Excel 2007 32 bit )
    15678
    191011
    112131415
    16171811920
    Worksheet: def
    _____ Workbook: VBA Exampled.xls ( Using Excel 2007 32 bit )



    'and the data which are not matched compare that data ( here 'that data' means unmatched data in abc. Right? ) with Fake Data and
    ' if matched then delete and again if there will be unmatched data ( here also 'unmatched data' means unmatched data in abc. Right? ) then

    _____ Workbook: VBA.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    1
    115678
    2
    191011
    3
    1112131415
    4
    1.16172E+11
    Worksheet: Fake Data
    _____ Workbook: VBA Exampled.xls ( Using Excel 2007 32 bit )

    15678
    112131415
    16171811920
    Worksheet: def
    115678
    1112131415
    1.16172E+11
    Worksheet: Fake Data



    '................................................. ...................if there will be unmatched data then
    ' compare that data with complete data

    _____ Workbook: VBA.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    1
    115678
    2
    Worksheet: Completed
    ' if found then delete and again if there will be unmatched data
    1112131415
    1.16172E+11
    Worksheet: Fake Data
    then
    ' copy that data and paste it to missing data sheet in column A ( and finally delete all the data in def : after the process completed delete all the data in this sheet )

    Quote Originally Posted by fixer View Post
    the final result is in missing data sheet plz see
    missing data sheet already has data and we have pasted the result below that data(the data starts with A2 is the result)
    A1 in missing data sheet already has data so we putted the result below that plz see sir
    ....in simple words with def sheet the data which are present in column A doesnt match with any sheet column A data then put that data in missing data sheet sir (sheet can be many)
    _____ Workbook: VBA.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    1
    11111158
    2
    1112131415
    3
    1.16172E+11
    4
    Worksheet: Missing data
    _____ Workbook: VBA Exampled.xls ( Using Excel 2007 32 bit )
    11111158
    1112131415
    1.16172E+11
    Worksheet: Missing data

  4. #194
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10
    follow on from last post:

    Before
    Quote Originally Posted by fixer View Post
    the final result is in missing data sheet plz see
    missing data sheet already has data and we have pasted the result below that data(the data starts with A2 is the result)
    A1 in missing data sheet already has data so we putted the result below that plz see sir
    _____ Workbook: VBA Before.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    1
    11111158
    2
    3
    4
    Worksheet: Missing data
    _____ Workbook: VBA Before.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    1
    1234
    2
    5678
    3
    91011
    4
    12131415
    5
    1617181920
    6
    Worksheet: abc
    _____ Workbook: VBA Before.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    1
    1234
    2
    15678
    3
    191011
    4
    112131415
    5
    16171811920
    after the process completed delete all the data in this sheet
    Worksheet: def
    _____ Workbook: VBA Before.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    1
    115678
    2
    191011
    3
    1112131415
    4
    1.16172E+11
    5
    Worksheet: Fake Data
    _____ Workbook: VBA Before.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    1
    115678
    2
    Worksheet: Completed
    _____ Workbook: VBA Before.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    1
    11111158
    2
    3
    4
    Worksheet: Missing data
    Attached Files Attached Files

  5. #195
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10
    Follow on from last 2 posts





    Explanation attempt
    Column A of worksheet abc is compared with column A of worksheet def, looking for matches in data. If data in Column A of worksheet def is also found in column A of worksheet abc, then that matched data in column A of worksheet def is deleted
    _____ Workbook: VBA worked excample.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    1
    1234
    2
    5678
    3
    91011
    4
    12131415
    5
    1617181920
    6
    Worksheet: abc
    _____ Workbook: VBA worked excample.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    1
    1234
    2
    15678
    3
    191011
    4
    112131415
    5
    16171811920
    Worksheet: def
    Column A of worksheet abc is compared with column A of worksheet def, looking for matches in data. If data in Column A of worksheet def is also found in column A of worksheet abc, then that matched data in column A of worksheet def is deleted
    _____ Workbook: VBA worked excample.xls ( Using Excel 2007 32 bit )
    1234
    15678
    191011
    112131415
    16171811920
    Worksheet: def (modified)


    The remain data in worksheet def is now compared with column A of worksheet Fake Data.
    _____ Workbook: VBA worked excample.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    1
    115678
    2
    191011
    3
    1112131415
    4
    1.16172E+11
    5
    Worksheet: Fake Data
    If data in Column A of worksheet Fake Data is also found in column A of the modified worksheet def, then that matched data in column A of worksheet Fake Data is deleted
    _____ Workbook: VBA worked excample.xls ( Using Excel 2007 32 bit )
    115678
    191011
    1112131415
    1.16172E+11
    Worksheet: Fake Data (modified)

    The remaining data in column A of modified worksheet Fake Data is now compared with column A of worksheet Completed
    _____ Workbook: VBA worked excample.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    1
    115678
    2
    Worksheet: Completed
    If there is a match in data in columns A of worksheet Completed, and column A of worksheet Fake Data, then delete that matched data from worksheet Fake Data
    _____ Workbook: VBA worked excample.xls ( Using Excel 2007 32 bit )
    115678
    191011
    1112131415
    1.16172E+11
    Worksheet: Fake Data (modified)

    If there is now any remaining data in column A of modified Fake Data, then that data is added to column A of missing data , ( in the given example, VBA Before.xls , A1 in missing data sheet already had data
    _____ Workbook: VBA worked excample.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    1
    11111158
    2
    Worksheet: Missing data
    so we put the result below that:
    _____ Workbook: VBA worked excample.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    1
    11111158
    2
    1112131415
    3
    1.16172E+11
    4
    Worksheet: Missing data (final)
    Attached Files Attached Files

  6. #196
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10
    Coding for this Thread
    http://www.excelfox.com/forum/showth...ll=1#post11794


    Code:
    Sub MakeFormulas3() '  http://www.excelfox.com/forum/showthread.php/2390-Apply-Vlookup-formula-in-all-the-available-sheets-in-a-workbook?p=11794&viewfull=1#post11794
    Rem 1 '  Workbooks info
    ' 1a This months book, this workbook. It is the outout book for the current month
    Dim ThisMonthsLatestBook As Workbook, LisWbName As String
     Set ThisMonthsLatestBook = ThisWorkbook ' ActiveWorkbook
     Let LisWbName = ThisMonthsLatestBook.Name
        If InStr(7, LisWbName, Format(Now(), "MMM"), vbTextCompare) = 0 Then MsgBox Prompt:="This workbook is not for " & Format(Now(), "MMMM"): Exit Sub
    Dim BookN As Long
     Let BookN = Mid(LisWbName, 5, InStr(5, LisWbName, "_", vbBinaryCompare) - 5)
    ' 1b Last months book
    Dim sourceBookName As String
     Let sourceBookName = "Book" & BookN - 1 & "_" & Format(DateAdd("m", -1, Now()), "MMM YYYY") & ".xlsm"
    Dim sourceBook As Workbook
     Set sourceBook = Workbooks.Open(ThisWorkbook.Path & "\" & sourceBookName)
    Rem 2  Make records worksheet                                                                  Sub MakeWorkSheetIfNotThere()
    'Dim Wb As Workbook '                                   ' ' Dim:  ' Preparing a "Pointer" to an Initial "Blue Print" in Memory of the Object ( Pigeon Hole with a bit of paper or code lines on that can be filled in to refer to a specific Objec of this type ) . This also us to get easily at the Methods and Properties throught the applying of a period ( .Dot) ( intellisense )                     '
    ' Set Wb = ActiveWorkbook '  '                            Set now (to Active Workbook - one being "looked at"), so that we carefull allways referrence this so as not to go astray through Excel Guessing inplicitly not the one we want...         Set: Values are filled at the memory locations and the directions there are specified in the variable "Blue Print "Pointer". In this case a Filled in Blue Print is passed.      http://www.excelforum.com/excel-programming-vba-macros/1138804-help-understanding-class-instancing-cant-set-ws-new-worksheet-intellisense-offers-it-4.html#post4387191                                '
         If Not Evaluate("=ISREF(" & "'" & "Records" & "'!Z78)") Then '   ( the '  are not important here, but iin general allow for a space in the worksheet name like  "My Records"
         ThisMonthsLatestBook.Worksheets.Add After:=ThisMonthsLatestBook.Worksheets.Item(Worksheets.Count) 'A sheeet is added and will be Active
        Dim wsRcds As Worksheet '
         Set wsRcds = ThisMonthsLatestBook.Worksheets.Item(ThisMonthsLatestBook.Worksheets.Count)        'Rather than rely on always going to the active sheet, we referr to it Explicitly so that we carefull allways referrence this so as not to go astray through Excel Guessing implicitly not the one we want...    Set: Values are filled at the memory locations and the directions there are specified in the variable "Blue Print "Pointer". In this case a Filled in Blue Print is passed.      http://www.excelforum.com/excel-programming-vba-macros/1138804-help-understanding-class-instancing-cant-set-ws-new-worksheet-intellisense-offers-it-4.html#post4387191            ' Values are filled at the memory locations and the directions there are specified in the variable "Blue Print "Pointer". In this case a Filled in Blue Print is passed.      http://www.excelforum.com/excel-programming-vba-macros/1138804-help-understanding-class-instancing-cant-set-ws-new-worksheet-intellisense-offers-it-4.html#post4387191
         wsRcds.Activate: wsRcds.Cells(1, 1).Activate ' ws.Activate and activating a cell sometimes seemed to overcome a strange error
         Let wsRcds.Name = "Records"
        Else ' The worksheet is already there , so I just need to set my variable to point to it
         Set wsRcds = ThisWorkbook.Worksheets("Records")
        End If
    '                                                                                               End Sub
    Rem 3 looping through worksheets
    Dim C As Long, I As Long
    'C = ActiveWorkbook.Worksheets.Count
     'Let C = ThisWorkbook.Worksheets.Count
     Let C = ThisMonthsLatestBook.Worksheets.Count - 1  '   -1 since last worksheet is records worksheet
        'For I = 1 To C
    'Application.ScreenUpdating = True
        For I = 1 To C   '   Sheet1  , Sheet2   , Sheet3 .......
        'what are  our worksheets?                         I   =  1        ,       2 ,      3    ..........
        Dim sourceSheet As Worksheet
         Set sourceSheet = sourceBook.Worksheets.Item(I) '     ("Sheet1")  , Sheet2   , Sheet3 ........
        Dim outputSheet As Worksheet
         Set outputSheet = ThisWorkbook.Worksheets.Item(I) ' ("Sheet1")    , Sheet2   , Sheet3 ........
           
            'Determine last row of source
            With sourceSheet
            Dim SourceLastRow As Long
             SourceLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
            End With
            With outputSheet
            'Determine last row in col P
            Dim OutputLastRow As Long
             OutputLastRow = .Cells(.Rows.Count, "P").End(xlUp).Row
            End With
            'Apply our formula in records worksheet
            With Worksheets("Records")
             Let .Cells.Item(1, I).Value = sourceSheet.Name   '  Header in column as worksheet name
             '.Range("Q2:Q" & OutputLastRow).Formula = "=VLOOKUP($A2,'[" & sourceBook.Name & "]" & sourceSheet.Name & "'!$A$2:$P$" & SourceLastRow & ",3,0)"
             .Range("" & CL(I) & "2:" & CL(I) & "" & OutputLastRow).Value = "=VLOOKUP(" & outputSheet.Name & "!$A2,'" & sourceBook.Path & "\" & "[" & sourceBook.Name & "]" & sourceSheet.Name & "'!$A$2:$P$" & SourceLastRow & ",3,0)"
    '        .Range("" & CL(I) & "2:" & CL(I) & "" & OutputLastRow).Value = .Range("" & CL(I) & "2:" & CL(I) & "" & OutputLastRow).Value
            End With
         'MsgBox ActiveWorkbook.Worksheets(I).Name
         MsgBox ActiveWorkbook.Worksheets.Item(I).Name
        Next I
    'Next P
    Rem 4
    Dim cel As Range
        With Worksheets("Records").UsedRange
            For Each cel In .Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count)
                If IsError(cel.Value) Then
                '
                Else
                    If cel.Value < 3 Then
                     cel.Font.Color = vbRed
                    Else
                     cel.Font.Color = vbGreen
                    End If
                End If
            Next cel
        End With
        
    'Close the source workbook, don't save any changes
     sourceBook.Close False
    ' Application.ScreenUpdating = True
    End Sub
    '   https://www.excelforum.com/development-testing-forum/1101544-thread-post-appendix-no-reply-needed-please-do-not-delete-thanks-4.html#post4213980
    Function CL(ByVal lclm As Long) As String 'Using chr function and Do while loop      For example http://www.excelforum.com/excel-programming-vba-macros/796472-how-to-go-from-column-number-to-column-letter.html
    Dim rest As Long 'Variable for what is "left over" after subtracting as many full 26's as possible
        Do
        '    Let rest = ((lclm - 1) Mod 26) 'Gives 0 to 25 for Column Number "Left over" 1 to 26. Better than ( lclm Mod 26 ) which gives 1 to 25 for clm 1 to 25 then 0 for 26
        '    Let FukOutChrWithDoWhile = Chr(65 + rest) & FukOutChrWithDoWhile 'Convert rest to Chr Number, initially with full number so the "units" (0-25), then number of 26's left over (if the number was so big to give any amount of 26's in it, then number of 26's in the 26's left over (if the number was so big to give any amount of 26 x 26's in it, Enit ?
        '    'OR
        Let CL = Chr(65 + (((lclm - 1) Mod 26))) & CL
        Let lclm = (lclm - (1)) \ 26 'This gives the number of 26's ( if any ), but just the excact part, in the next number down , - so applying the rest formula to this new number will again leave a difference "left over" rest.
        'lclm = (lclm - (rest + 1)) \ 26 ' As the number is effectively truncated here, any number from 1 to (rest +1)  will do in the formula
        Loop While lclm > 0 'Only loop further if number was big enough to still have 0-25's in it
    End Function
    Attached Files Attached Files

  7. #197
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10
    Notes in support of this Forum Question:
    https://www.eileenslounge.com/viewto...p?f=18&t=33834

    Trying to figure out how Excel Clipboard ( or maybe Office clipboard ) is interacting with the Windows clipboard when trying to paste into Excel a text string,….

    I have a text string. I add to it, manipulate it a bit, then put it in "the clipboard", ( probably the windows clipboard ) , then do an Excel Worksheets Paste

    Simplified example
    I have this already in a string,
    "A" & vbCr & vbLf & "C"
    Seen in another way:
    A_vbCr_vbLf_B
    The first representation is in a typical code line convention, the second an attempt at a more "real" view
    There are 4 characters there. The middle two are examples of types that are often referred to as "invisible" characters. (These two typically instruct systems to go to a new line)
    Most software that visibly gives you some sort of text to see , would usually interpret that as two lines of text. For example, Excel would usually interpret that such as to display you something like this, if you somehow "put it in" the start ( top left ) of a spreadsheet:
    Row\Col
    A
    1
    A
    2
    C


    I want to put an extra cell with split line text in it, simplified like this:
    Row\Col
    A
    1
    A
    2
    X
    Y
    3
    C


    Sometime or other I have learnt that Excel recognises a single vbLf to split up lines of text within a cell. But it turns out to be bit more complicated than that if you want the text string in the Windows Clipboard to come out as you want it in Excel.

    The second part of this macro seems to usually achieve the second screenshot above
    Code:
    Sub TestvbLf_1()
    Dim objDataObject As Object: Set objDataObject = GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
    Dim StringBack As String
    ' Fill two rows , in 1 column
     ActiveSheet.Cells.Clear ' This is important to remove any formatting that might distort results
     objDataObject.SetText "A" & vbCr & vbLf & "C": objDataObject.PutInClipboard
     ActiveSheet.Paste Destination:=ActiveSheet.Range("A1")
     objDataObject.GetFromClipboard: Let StringBack = objDataObject.GetText()
     Call WtchaGot(StringBack) '         "A" & vbCr & vbLf & "C"
    ' Put an extra cell with split line text in it
     ActiveSheet.Cells.Clear '
     objDataObject.SetText "A" & vbCr & vbLf & """" & "X" & vbLf & "Y" & """" & vbCr & vbLf & "C": objDataObject.PutInClipboard
     ActiveSheet.Paste Destination:=ActiveSheet.Range("A1")
     objDataObject.GetFromClipboard: Let StringBack = objDataObject.GetText()
     Call WtchaGot(StringBack) '          "A" & vbCr & vbLf & """" & "X" & vbLf & "Y" & """" & vbCr & vbLf & "C"
     
    End Sub
    ( The function, WtchaGot( ) can be found here: http://www.excelfox.com/forum/showth...ll=1#post10946 )




    Here are some further sample code snippets and discussions

    This code snippet suggest to me that the Windows clipboard is being used, as .Clear does not empty "the clipboard" , as one more typically annoyingly experiences in Excel work when copying things manually or with VBA in Excel
    Code:
    Sub TestvbLf_2()
    Dim objDataObject As Object: Set objDataObject = GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
    Dim StringBack As String
    
    ' Put an extra cell with split line text in it
     ActiveSheet.Cells.Clear '
     objDataObject.SetText "A" & vbCr & vbLf & """" & "X" & vbLf & "Y" & """" & vbCr & vbLf & "C": objDataObject.PutInClipboard
     ActiveSheet.Paste Destination:=ActiveSheet.Range("A1")
     objDataObject.GetFromClipboard: Let StringBack = objDataObject.GetText()
     Call WtchaGot(StringBack) '   ---    "A" & vbCr & vbLf & """" & "X" & vbLf & "Y" & """" & vbCr & vbLf & "C"
     
     ActiveSheet.Cells.Clear ' This does not clear the clipboard, so next line gives the same results, which...
     ActiveSheet.Paste Destination:=ActiveSheet.Range("A1") '   suggests that the Windows  clipboard is being used
     Call WtchaGot(StringBack) '   ---    "A" & vbCr & vbLf & """" & "X" & vbLf & "Y" & """" & vbCr & vbLf & "C"
    '
    End Sub
    Finally we see this, the orange of the clipboard icon indicating something is in "the clipboard", presumably the windows clipboard, since , as said, .Clear does not clear that icon, and also we see that the office clipboard is empty…
    TestvbLf_2.JPG : https://imgur.com/dEbsaPE
    Attachment 2565

    ( Using Excel 2007 32 bit )
    A 19 Dez 2019
    Lenf is 11
    A
    "X
    Y"
    C
    X
    Y
    1 A 65
    C 2 13
    3 10
    4 " 34
    5 X 88
    6 10
    7 Y 89
    8 " 34
    9 13
    10 10
    11 C 67
    Worksheet: WotchaGotInString
    The second two columns are produced by function WtchaGot( ) , and give a breakdown of the 11 characters in the string:
    "A" & vbCr & vbLf & """" & "X" & vbLf & "Y" & """" & vbCr & vbLf & "C"
    A vbCr vbLf " X vbLf Y " vbCr vbLf C


    Further investigation in next post
    Attached Images Attached Images

  8. #198
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10

    Thoughts on adding split lines in Excel cells via the ( probably windows ) Clipboard

    In support of these posts

    https://stackoverflow.com/questions/...60767#54960767
    https://www.eileenslounge.com/viewto...p?f=18&t=33834



    Thoughts on adding split lines in Excel cells via the ( probably windows ) Clipboard

    The following code snippet is typical of those which got me to the solution of how to manipulate a text string so that it pastes into Excel a cell with multiple lines.
    The first section shows me what the text in "the clipboard" looks like after using Excel ways to copy my final desired test form , after using Excel ways to produce it. It gives this sort of output
    "A" & vbCr & vbLf & """" & "X" & vbLf & "Y" & """" & vbCr & vbLf & "C" & vbCr & vbLf
    A vbCr vbLf " X vbLf Y " vbCr vbLf C vbCr vbLf
    TestvbLf_3.jpg : https://imgur.com/oPXJIkG
    Attachment 2566

    Either code sections 2 and 3 would error, presumably because the windows clipboard has been emptied. That is not totally understandable. We know that we had something in the windows clipboard. Doing things that empty "clipboards" , possibly other than the window clipboard, seem also somehow to remove things from the windows clipboard.
    Possibly we could explain this by saying that as Excel filled the windows clipboard as a sort of extra thing to do after primarily filling its clipboard, then some linking wiring in place to do that also resulted into it clearing the windows clipboard when it cleared its clipboard
    Code section 4 erroring is less understandable, as we did not use normal Excel ways to fill the window clipboard, but never the less .Clear seems to empty it.
    Code section 5 erroring is similarly less understandable, since it is generally considered that Application.CutCopyMode = False clears the Excel clipboard

    Before going on to sections 7 and 8, copy something to the "clipboard" from anywhere.
    We find that section 7 and 8 would still error. This once again seems to be caused by either .Clear or .CutCopyMode = False. It suggests that there is some link to the windows clipboard that causes it to be cleared. It suggests perhaps that something has been set to link things in the windows clipboard from Excel or office, possibly to get some formatting parameters. If you put anything into the windows clipboard, it will still be cleared when doing .Clear or .CutCopyMode = False , by virtue of this linking "wiring"

    Section 9 probably removes this linking wiring.
    When a manual copy is then made in the following sections , possibly a new wiring is set up which has a different sort of dependency.

    Before going on to section 10 and then again before going on to section 11, copy something to the "clipboard" from anywhere.
    The code lines of .Clear or .CutCopyMode = False at the start of these sections do not remove the orange from the icon top left, and code sections 10 and 11 do not error. This supports the idea that a link was made to the windows clipboard that works slightly differently.



    Code:
    Sub TestvbLf_3()
    ActiveSheet.Cells.Clear
    
    
    Dim objDataObject As Object: Set objDataObject = GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
    Dim StringBack As String
    ' Section 1
     ActiveSheet.Range("A1").Value = "A"
     ActiveSheet.Range("A2").Value = "X" & vbLf & "Y"
     ActiveSheet.Range("A3").Value = "C"
     ActiveSheet.Range("A1:A3").Copy
     objDataObject.GetFromClipboard: Let StringBack = objDataObject.GetText()
     Call WtchaGot(StringBack)
     'ActiveSheet.Cells.Clear ' --- This clears "the clipboard",
     ActiveSheet.Paste Destination:=ActiveSheet.Range("D1")
     
    ' Section 2
    ' ActiveSheet.Cells.Clear ' --- This clears "the clipboard"
    ' objDataObject.GetFromClipboard: Let StringBack = objDataObject.GetText() ' This errors
    ' Call WtchaGot(StringBack)
    
    ' Section 3
    ' Application.CutCopyMode = False
    ' objDataObject.GetFromClipboard: Let StringBack = objDataObject.GetText() ' This errors
    ' Call WtchaGot(StringBack)
    
    ' Section 4
    ' objDataObject.SetText "A" & vbCr & vbLf & """" & "X" & vbLf & "Y" & """" & vbCr & vbLf & "C": objDataObject.PutInClipboard
    ' ActiveSheet.Cells.Clear
    ' objDataObject.GetFromClipboard: Let StringBack = objDataObject.GetText() ' This errors
    ' Call WtchaGot(StringBack)
    
    ' Section 5
    ' objDataObject.SetText "A" & vbCr & vbLf & """" & "X" & vbLf & "Y" & """" & vbCr & vbLf & "C": objDataObject.PutInClipboard
    ' Application.CutCopyMode = False
    ' objDataObject.GetFromClipboard: Let StringBack = objDataObject.GetText()
    ' Call WtchaGot(StringBack)
     
    Stop  ' BEFORE DOING THE NEXT CODE SECTIONs, copy something manually via Ctrl+c ...
    ' Section 7
    ' ActiveSheet.Cells.Clear
    ' objDataObject.GetFromClipboard: Let StringBack = objDataObject.GetText() ' This errors
    ' Call WtchaGot(StringBack)
    '
    '' Section 8
    ' Application.CutCopyMode = False
    ' objDataObject.GetFromClipboard: Let StringBack = objDataObject.GetText() ' This errors
    ' Call WtchaGot(StringBack)
    
    ' Section 9
     ActiveSheet.Cells.Clear  ' This I think breaks the link from other clipboards to the windows clipboard.
    ' Application.CutCopyMode = False ' this line as alternative to the last has the same effect
    
    Stop  ' BEFORE DOING THE NEXT CODE SECTIONs, copy something manually via Ctrl+c ...
    
    ' Section 10
     ActiveSheet.Cells.Clear
     objDataObject.GetFromClipboard: Let StringBack = objDataObject.GetText()
     Call WtchaGot(StringBack)
     ActiveSheet.Paste Destination:=ActiveSheet.Range("E1")
    
    Stop  ' BEFORE DOING THE NEXT CODE SECTIONs, copy something manually via Ctrl+c ...
    
    ' Section 11
     Application.CutCopyMode = False
     objDataObject.GetFromClipboard: Let StringBack = objDataObject.GetText()
     Call WtchaGot(StringBack)
     ActiveSheet.Paste Destination:=ActiveSheet.Range("H1")
    
    End  Sub
    Attached Images Attached Images

  9. #199
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10
    Some notes in support of these Threads
    http://www.eileenslounge.com/viewtopic.php?f=18&t=33775
    http://www.eileenslounge.com/viewtop...d7141c#p262009
    http://www.excelfox.com/forum/showth...ll=1#post11570
    http://www.excelfox.com/forum/showth...ll=1#post11608




    VPN and IP Addresses
    Some of the initial investigations into testing VPN and in looking at problems showed that it was useful to be able to monitor various IP addresses.
    The main (Public) address, as already discussed, ( http://www.excelfox.com/forum/showth...ll=1#post11597 ) , is of course important to know . There is also a "local host", which more typically is set to the same number for everyone, (127.0.0.1 ). This is a number which conventionally is used to allow direct access to network aspects of your computer which might otherwise be accessed externally in some way or another. A characteristic of VPN software is that it manipulate your computer in a way such that, amongst other things , this number will change to the internal address used at your VPN provider to identify you within their system. It is part of the trickery in the Client software, that you "looking at yourself" gets manipulated into looking somewhere else. The provider in some ways is then in control of your computer allowing them to give the impression that your computer is physically somewhere else: Part of your computer "Soul" is with them.

    Public address
    Manually this is achieved typically by visiting various sites that provide you with this information. The automated way still needs to use such sites. The reason for this is that you need to be able to get the information by accessing yourself in the way that another computer connected to the internet "gets at you". Part of this process involves obtaining your public address as you communicate initially with them. We could scrap any site offering the service and pick out the IP address information.
    We can simplify the coding to do this by accessing a site available which only gives the IP information, and which shows as the website that you "see" just that IP address number.
    So for example if you type in your browser URL bar, http://myip.dnsomatic.com/ , then all you will see is the IP address. You will even see only that if you are in Google Chrome Browser and right click and view the Page Source
    Page Source myip dnsomatic .JPG : https://imgur.com/uceUKE4

    This information will be the entire .responseText received back. In normal scrapping coding you might feed this supplied text string into an object model software which allows you to then pick out using OOP type techniques what you want. If we use the site http://myip.dnsomatic.com/ , we don't need to take that extra step, and can simply view the entire .responseText , as this is the exact info we want.

    ( I found that sometimes the first one or few attemps did not work in the next coding, but almost always after a few attemopts it worked. So the recursion technique is used to call the Function a few times , if necerssary )

    Code:
    Option Explicit
    Sub TestPubicIP()
    Dim strIP As String
     Call PubicIP(strIP)
     MsgBox prompt:=strIP
     'Call WtchaGot(strIP)
    End Sub
    ' Because we have ByRef PublicIP  , the is effectively taking the variable  strIP  into the function, and similarly in the  recursion Call line  that variable is taken.  Hopefull in one of the 5 attepts at running the Function  it will be filled.. We don't actually fill the pseudo variable  PubicIP  so no value is returned directly by the Function. (So we could have used a Sub()routine instead)  To get a returned value we look at the value in  strIP  after runing the routine , because , as said, hopefully that particular variable will have been added to
    Function PubicIP(ByRef PublicIP As String, Optional ByVal Tries As Long) As String
        If Tries = 5 Then Exit Function
     On Error GoTo Bed
        With CreateObject("msxml2.xmlhttp")
         .Open "GET", "http://myip.dnsomatic.com", True ' 'just preparing the request type, how and what type... "The True/False argument of the HTTP Request is the Asynchronous mode flag. If set False then control is immediately returns to VBA after Send is executed. If set True then control is returned to VBA after the server has sent back a response.
         'No extra info here for type GET
         '.setRequestHeader bstrheader:="Ploppy", bstrvalue:="Poo"
         .setRequestHeader bstrheader:="If-Modified-Since", bstrvalue:="Sat, 1 Jan 2000 00:00:00 GMT" '  https://www.autohotkey.com/boards/viewtopic.php?t=9554  ---   It will caching the contents of the URL page. Which means if you request the same URL more than once, you always get the same responseText even the website changes text every time. This line is a workaround : Set cache related headers.
         .send ' varBody:= ' No extra info for type GET. .send actually makes the request
            While .readyState <> 4: DoEvents: Wend ' Allow other processes to run while the web page loads. Think this is part of the True option
        Dim PageSrc As String: Let PageSrc = .responseText ' Save the HTML code in the (Global) variable. ': Range("P1").Value = PageSrc 'For me for a print out copy to text file etc.    The responseText property returns the information requested by the Open method as a text string
        End With
     Let PublicIP = PageSrc: ' Debug.Print PubicIP
     'Call WtchaGot(PubicIP)
         If PublicIP = "" Then Call PubicIP(PublicIP, Tries + 1) ' Recursion Call line. I do this because sometines it seems to need more than one try before it works
    Exit Function
    Bed:
     Let PubicIP = Err.Number & ":  " & Err.Description: Debug.Print PubicIP
    End Function

    As an alternative , I have below a similar coding. It gets the page source from another site which shows your IP address. I found when looking at the page source in Google Chrome, that I could see the IP address conveniently showing between two simple text lines :
    Page Source whatismyipaddress_com .JPG : https://imgur.com/LSvORAe
    Attachment 2567

    To VBA ( or most computer things), that text looks like a long string, and at that point we can imagine that it looks to the computer like any one of these 3 representations
    ……. ipt -->" & vbLf & "87" & "." & "101" & "." & "95" & "." & "204" & vbLf & "<!—do not scr……..
    …….ipt --> vbLf 87.101.95.204 vbLf <!—do not scr ………….

    …….ipt --> vbLf
    87.101.95.204 vbLf
    <!—do not scr ……
    …….


    We apply some simple VBA strings manipulation techniques to extract just the IP address number
    Code:
    '
    Sub TestPubicIPwhatismyipaddress_com()
    Dim strIP As String
     Let strIP = PubicIPwhatismyipaddress_com
     MsgBox prompt:=strIP
    End Sub
    Function PubicIPwhatismyipaddress_com() As String
     On Error GoTo Bed
        With CreateObject("msxml2.xmlhttp")
         .Open "GET", "https://whatismyipaddress.com/de/meine-ip", False ' 'just preparing the request type, how and what type... "The True/False argument of the HTTP Request is the Asynchronous mode flag. If set False then control is immediately returns to VBA after Send is executed. If set True then control is returned to VBA after the server has sent back a response.
         'No extra info here for type GET
         '.setRequestHeader bstrheader:="Ploppy", bstrvalue:="Poo"
         .setRequestHeader bstrheader:="If-Modified-Since", bstrvalue:="Sat, 1 Jan 2000 00:00:00 GMT" '  https://www.autohotkey.com/boards/viewtopic.php?t=9554  ---   It will caching the contents of the URL page. Which means if you request the same URL more than once, you always get the same responseText even the website changes text every time. This line is a workaround : Set cache related headers.
         .send ' varBody:= ' No extra info for type GET. .send actually makes the request
            While .READYSTATE <> 4: DoEvents: Wend ' Allow other processes to run while the web page loads. Think this is part of the True option
        Dim PageSrc As String: Let PageSrc = .responsetext ' Save the HTML code in the (Global) variable. ': Range("P1").Value = PageSrc 'For me for a print out copy to text file etc.    The responseText property returns the information requested by the Open method as a text string
        End With
     Let PubicIPwhatismyipaddress_com = PageSrc: ' Debug.Print PubicIPwhatismyipaddress_com
    Dim IPadres As String, posIPadres1 As Long, posIPadres2 As Long
     Let posIPadres1 = InStr(1, PageSrc, "<!-- do not script -->", vbBinaryCompare)  '      Screenshot --->   Page Source whatismyipaddress_com .JPG : https://imgur.com/LSvORAe
     Let posIPadres2 = InStr(posIPadres1 + 1, PageSrc, "<!-- do not script -->", vbBinaryCompare)
     Let PubicIPwhatismyipaddress_com = Mid(PageSrc, posIPadres1 + 23, ((posIPadres2 - 1) - (posIPadres1 + 23)))
     Call WtchaGot(PubicIPwhatismyipaddress_com)
    Exit Function
    Bed:
     Let PubicIPwhatismyipaddress_com = Err.Number & ":  " & Err.Description: Debug.Print PubicIPwhatismyipaddress_com
    End Function



    Local Host address and computer name in the next post




    Attached Images Attached Images

  10. #200
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10




    Local Host address, Computer name
    There are a couple of Win32 APIs which will get this information.
    We just need to write a small amount of coding to get the function to do what we want and also a bit of manipulaation to give the information as we need it.
    For the computer name this is simply a function to give us a string.
    Code:
    Option Explicit
    Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, ByRef nSize As Long) As Long
    '  "GetComputerNameA" (ByVal lpBuffer As String, ByRef nSize As Long) As Long
    Function ComputerName() As String                                                                                                                                                                        ' GHB and sex..
    Dim NmeLen As Long, lngX As Long, strCompName As String
     Let NmeLen = 999: Let strCompName = "                                     "     ' variables must be initialised or API things often dont work                                                            ' String$(50, 0)
     Let lngX = GetComputerName(strCompName, NmeLen) '
        If lngX <> 0 Then ' returns 1 if it works
         Let ComputerName = strCompName '   Left$(strCompName, NmeLen)   ' The first argument variable gets like a LSet done on it
        Else
         Let ComputerName = "Couldn't get Computer name"
        End If
     Let ComputerName = Left$(ComputerName, NmeLen) ' We must do this as there is a  Chr(0)  after the name ....  Let ComputerName = Trim(ComputerName) ' this is no good, - it leaves Chr(0) on the end which means that ComputerName is the last thing that will get printed
     'Call WtchaGot(ComputerName)
    End Function
    




    The Win32 API for the local IP address is slightly more complicated. It will give us a table/ array of all the IP addresses held. The first is generally that we are interested in. it seems to be added when a VPN connection is made
    Code:
    Option Explicit
    Private Declare Function GetIpAddrTable_API Lib "IpHlpApi" Alias "GetIpAddrTable" (ByRef pIPAddrTable As Any, ByRef pdwSize As Long, ByVal bOrder As Long) As Long    '   http://www.source-code.biz/snippets/vbasic/8.htm
    '  "GetIpAddrTable" (ByRef pIPAddrTable As Any, ByRef pdwSize As Long, ByVal bOrder As Long) As Long
    Public Function GetIpAddrTable() As String  '       Christian d'Heureuse, www.source-code.biz  http://www.source-code.biz/snippets/vbasic/8.htm
    Rem 1 We give the API function some info , and that seems to make it fill up an array with table values
    Dim Buf(0 To 1234) As Byte ' Buf(0 To 511) As Byte ' must be Byte or overflow at NrOfEntries
    Dim BufSize As Long: Let BufSize = 12345
    Dim rc As Long: Let rc = GetIpAddrTable_API(Buf(0), BufSize, 1)
       'If rc <> 0 Then Err.Raise vbObjectError, , "GetIpAddrTable failed with return value " & rc
    Dim NrOfEntries As Integer: NrOfEntries = Buf(1) * 256 + Buf(0)
       'If NrOfEntries = 0 Then GetIpAddrTable = Array(): Exit Function
    
    Dim i As Long
       For i = 0 To NrOfEntries - 1
        Dim j As Long, s As String
          For j = 0 To 3
          Dim Indcy As Long: Let Indcy = 4 + i * 24 + j
           s = s & IIf(j > 0, ".", "") & Buf(Indcy): Debug.Print Indcy & "   " & Buf(Indcy) ' This code line just builds the final string for each IP address, with a "." before all but the first of the 4 number parts  ---  for example like  192 . 168 . 2 . 110
          Next j
         Dim strIPs As String: Let strIPs = strIPs & "   " & s: Let s = ""
        Next
       GetIpAddrTable = strIPs: Debug.Print strIPs
    End Function
    
    '    4   127
    '    5   0
    '    6   0
    '    7   1
    '    28   192
    '    29   168
    '    30   2
    '    31   110
    '       127.0.0.1   192.168.2.110                                                                                          ' _
    
    '    4   10
    '    5   132
    '    6   13
    '    7   113
    '    28   127
    '    29   0
    '    30   0
    '    31   1
    '    52   192
    '    53   168
    '    54   2
    '    55   110
    '       10.132.13.113   127.0.0.1   192.168.2.110
    '     1  2  3    4   5   6  7      8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
    '    25 26 27   28  29  30  31     32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
    '    49 50 51   52  53  54  55
    '               10  132  13  127
    '               127  0   0   1
    '               192 168  2  110

    If we examine that coding above, and experiment with what it does, we see a couple of things:
    Rem 1
    _ It is doing a strange thing, as API's often do. That is to say the API works similarly to a normal VBA function, except the way each argument is a mystery.. following some set of rules/coding which probably the author wrote when he was drunk and no one can remember anymore.
    You must make an array of Byte types. The array should be fairly big.
    You must give the first array element and the size of the array to the API Function.
    Then magically the array gets filled. Presumably some internally held table is put into the array
    Rem 2
    A bit of maths is done to pick out the elements we want from the returned filled array

    The final analysis here of a typical output can be helpful to try and understand another way to get this information
    Code:
    '     1  2  3    4   5   6  7      8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
    '    25 26 27   28  29  30  31     32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
    '    49 50 51   52  53  54  55
    '               10  132  13  127
    '               127  0   0   1
    '               192 168  2  110
    Or maybe not. I am not sure. I doubt many people are…




Similar Threads

  1. Testing Concatenating with styles
    By DocAElstein in forum Test Area
    Replies: 2
    Last Post: 12-20-2020, 02:49 AM
  2. testing
    By Jewano in forum Test Area
    Replies: 7
    Last Post: 12-05-2020, 03:31 AM
  3. Replies: 18
    Last Post: 03-17-2019, 06:10 PM
  4. Concatenating your Balls
    By DocAElstein in forum Excel Help
    Replies: 26
    Last Post: 10-13-2014, 02:07 PM
  5. Replies: 1
    Last Post: 12-04-2012, 08:56 AM

Posting Permissions

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