作者:吟伶逸慧喜靖 | 来源:互联网 | 2023-06-06 09:54
IneedabitofhelpwithcreatingabatchfileandpasteingacertainrangefromexcelintoitBUT
I need a bit of help with creating a batch file and pasteing a certain range from excel into it BUT keeping the text as it is displayed in excel.
Exemple: (this is the content of a cell I want to paste into a batch file)
我需要一些帮助来创建批处理文件并将excel中的某个范围粘贴到它中但是保留excel中显示的文本。例子:(这是我要粘贴到批处理文件中的单元格的内容)
"pushd N:\contracte\CONTRACTE NEVOI PERSONALE\Contracte nevoi personale 102501N - 105000N\
for /f ""delims="" %%a in ('dir /b /s ^| find ""104020""') do (
cd ..
xcopy ""%%a"" ""C:\Users\agrigoriu\Desktop\COPIERE\"" /E /D /Y )
@ECHO ---"
Problem 1: all the content will be displayed in one single line like this: pushd N:\contracte\CONTRACTE NEVOI PERSONALE\Contracte nevoi personale 102501N - 105000N\ for /f ""delims="" %%a in ('dir /b /s ^| find ""104020""') do ( cd .. xcopy ""%%a"" ""C:\Users\agrigoriu\Desktop\COPIERE\"" /E /D /Y ) @ECHO ---"
问题1:所有内容将显示在一行中,如下所示:pushd N:\ contracte \ CONTRACTE NEVOI PERSONALE \ Contracte nevoi personale 102501N - 105000N \ for / f“”delims =“”%% a in('dir / b / s ^ | find“”104020“”')do(cd .. xcopy“”%% a“”“”C:\ Users \ agrigoriu \ Desktop \ COPIERE \“”/ E / D / Y)@ECHO ---”
Problem 2: it doubles every comma there is in the original text
问题2:它将原始文本中的每个逗号加倍
this is the code I have so far and it only pastes the information from the range into a notepad (with the problems stated above):
这是我到目前为止的代码,它只将来自范围的信息粘贴到记事本中(具有上述问题):
Sub test()
'The range that contains the values
Range("D:D").Copy
'Start Notepad And let it recieve focus
Shell "notepad.exe", vbNormalFocus
'Send the keys CTRL+V To Notepad (i.e the window that has focus)
SendKeys "^V"
End Sub
Ideea: One "solution" woud be to paste it first into Word and then copy it again and paste it into notepad but this must work with all standard computers and I observed that not that many have the Word app on vba turned on by default.
Ideea:一个“解决方案”应该首先将其粘贴到Word中,然后再将其复制并粘贴到记事本中,但这必须适用于所有标准计算机,我发现默认情况下没有多少人在vba上打开Word应用程序。
2 个解决方案