Open files containing spaces with Start Process

Hello,

I am trying to open PDF and Word files in MS Word using a Start Process so I can scrape data from them. I am having an issue where if the filename contains spaces, it will start word but attempt to open three word documents. e.g. If my document was named “hello world.docx”, it will try to open “hello.doc” and “world.doc”. See below screenshots:

image image imageimage

How would I overcome this without altering the filenames? I can’t use Word Application Scope because I have PDFs, and I can’t convert the PDFs as I need to keep the tables in the files exactly as they were. I also can’t scrape through Acrobat.

You need to surround the filename with double quotes marks.

VB.NET: """C:\Temp\Hello World.docx"""
C#: "\"C:\\Temp\\Hello World.docx\""

image

Hi @ptrobot,

How would I do this in a For Each, where the filename is the item?

imageimage

"""" + file + """"

image

1 Like

Hey @ptrobot,

This has worked, thank you very much!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.