Hello Team,

I'm opening excel file from command prompt using below command:

start excel.exe "D:\Temp\MyFile.xls" /e/%SR%-%CR%
SR and CR are two arguments being passed.

When Excel files open, I'm checking if it is being opened by command prompt or by user manually. This helps me decide if to expect arguments or not.

CmdRaw = GetCommandLine
    CmdLine = CmdToSTr(CmdRaw)
   If Right(CmdLine, 3) = "dde" Then
        'Not Opened from Batch File
        'Do Nothing
    'Opened from Batch File
    'Capture the SR and CR Numbers
End If
The problem is when opened by user manually. The file opens without Error if there is No other excel file already opened. It stays in IF block.

But, If there is some other excel file already opened and user tries to open this file, it goes into Else Part.

Can you please suggest.