Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #29292
    Shankey Verma
    Participant

    Hi,
    I am reaching out to you today regarding a challenge I am facing with a macro script I have created. The script is designed to copy an entire row from a CSV file and paste it into a new document, with the row’s entries separated by tabs replaced by new lines. I have also included commands for cell selection mode and adjusting cell alignment. However, I have encountered an issue that requires your expertise.

    When executing the macro, it successfully copies and pastes the row into the new document, but the second column data appears to be hidden or vanished visibly. Interestingly, when I click on a cell containing hidden data, it only displays the cell’s content visible in the cell which at top of the toolbar. I have made several attempts to resolve this issue but have not been successful.
    Code in .vbee format:-
    document.selection.StartOfLine
    document.selection.SelectLine() document.selection.Copy(eeCopyUnicode)
    Editor.NewFile()
    document.selection.Paste(eeCopyUnicode)

    document.selection.Replace “\t”, “\n”, eeReplaceAll Or eeFindReplaceRegExp, 0
    For i = 1 To 10 : document.selection.Replace “\n\n”, “\n”, eeReplaceAll Or eeFindReplaceRegExp, 0 : Next

    document.selection.Replace “] – “, “]\t”, eeReplaceAll Or eeFindReplaceRegExp, 0
    editor.ExecuteCommandByID 4471 ‘Selects the TSV (Tab-separated) mode.
    editor.ExecuteCommandByID 4092 ‘Sets the first one column heading and non-scrollable.
    editor.ExecuteCommandByID 4460 ‘Adjusts all separator positions in the CSV document.
    editor.ExecuteCommandByID 3901 ‘Adjusts all separator positions in the whole document.

    document.selection.StartOfDocument
    document.selection.SelectLine() document.selection.Copy(eeCopyUnicode)

    Dim startTime : startTime = Now : Do While DateDiff(“s”, startTime, Now) < 3 : Loop

    Set WshShell = CreateObject(“WScript.Shell”)
    WshShell.AppActivate “Notepad”
    WshShell.SendKeys “{ENTER}”
    Set WshShell = Nothing

    I have observed that the macro works correctly under two specific conditions & that second column’s visiable problem does not exist anymore is when:-

    1. Disabling the syntax checker via the “Tools” menu, after which the second column data appears instantly.
    2. Removing the following code from the script without making any other changes:-
    Dim startTime : startTime = Now : Do While DateDiff(“s”, startTime, Now) < 3 : Loop
    Set WshShell = CreateObject(“WScript.Shell”)
    WshShell.AppActivate “Notepad”
    WshShell.SendKeys “{ENTER}”
    Set WshShell = Nothing

    The second column only starts to appear when either of these scenarios is implemented.

    I kindly request your assistance in rectifying this issue. It would greatly benefit me and other users if the macro could function flawlessly, regardless of the presence of the syntax checker or the aforementioned code segment. Your guidance and support in resolving this matter would be greatly appreciated.

    Thank you for your attention to this matter, and I look forward to your expert advice.

    #29293
    Yutaka Emura
    Keymaster

    Can you please post a screenshot of the issue? If you can’t post a screenshot, please email me the screenshot.

    Thanks,

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.