Mapbasic : could not execute -- program could not be run

117 views
Skip to first unread message

StA

unread,
Jun 28, 2021, 7:42:05 PM6/28/21
to MapInfo-L
Good evening all,

I have a number of mapbasic scripts that run in mapinfo professional 11 and since last week after we migrated to a new citrix environment they stopped working.

The line that mapinfo indicates the error refers to export of search results to ms-office excel and/or word. I have logged in as a user (without admin rights) and run office and excel and word via mapbasic window without any issues. Proving that this is not an access issue. 
So my questions are:
- could this be related to mapinfo version which is old?
- could this be related with potentially something else in the script?(I know very vague question)

this is the part of the code that mapinfo indicates as error:

mi_loc = programDirectory$()
if mi_loc = "C:\Program Files (x86)\MapInfo\Professional11\" then 'runnng on 64-bit server
 exloc = "C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE"
 exloc = "C:\Program Files\Microsoft Office\Office16\EXCEL.EXE"
end if
run program exloc + "'path'\dcprint.xlsm" (in this instance updates and prints dcprint)

Any help or advice would be really appreciated

Thank you in advance

Stathis

Peter Horsbøll Møller

unread,
Jun 29, 2021, 1:53:36 AM6/29/21
to mapi...@googlegroups.com
Where is your XLSM file stored?
dcprint.xlsm

It also can relate to the security settings in Excel. Maybe you aren’t allowed to open macro-enabled spreadsheets?

Can you execute the full open statement through the MapBasic window and get the xlsm file open in Excel?
Can you open I through the Run command in the Windows Start button?

Peter Horsbøll Møller
Peter Horsbøll Møller
Principal Sales Engineer - Distinguished Engineer

 


Den 29. jun. 2021 kl. 01.42 skrev StA <staka...@gmail.com>:

dcprint.xlsm

StA

unread,
Jun 29, 2021, 6:01:22 AM6/29/21
to MapInfo-L

Good morning Peter and thank you for your prompt reply,

The dcprint.xlsm “lives” in one of our virtual servers a path which all users have read/write rights.

As recommended, I also changed the settings in excel so as to allow macro-enabled spreadsheets. (no-luck)

I can also fire excel and word via mapbasic window via run command as a normal user.

Interesting enough I can only use run command and cmd functionalities in windows as an admin user only, and not an as normal user due to security rules. Could that be the issue?

Thank you very much again.

Stathis

Peter Horsbøll Møller

unread,
Jun 29, 2021, 6:10:01 AM6/29/21
to mapi...@googlegroups.com

Does it help if you start MapInfo Pro as an Administrator?

You can also try wrapping the “Run Program” statement and use Run Command to execute it in the scope of MapInfo Pro as opposed to the scope of your application.

That should be the same as running the statement through the MapBasic window.

 

Run Command "run program " + Chr$(34) + "exloc" + Chr$(34) + " " + Chr$(34) + "'path'\dcprint.xlsm" + Chr$(34)

 

 

Peter Horsbøll Møller

www.precisely.com

 

Peter Horsbøll Møller

 

From: mapi...@googlegroups.com <mapi...@googlegroups.com> On Behalf Of StA
Sent: 29. juni 2021 12:01
To: MapInfo-L <mapi...@googlegroups.com>
Subject: Re: [MI-L] Mapbasic : could not execute -- program could not be run

 

This message originated Externally. Use proper judgement and caution with attachments, links, or responses.

 

--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapinfo-l/e24c481c-dcfd-44f6-9e0e-0d8fc22efa1bn%40googlegroups.com.

StA

unread,
Jun 29, 2021, 7:27:07 AM6/29/21
to MapInfo-L

good afternoon Peter and thank you for your email,

starting mapinfo as an admin didn't work

can you please expand on your suggestion as i don't fully understand it.

Thank you very much again

Stathis

Peter Horsbøll Møller

unread,
Jun 30, 2021, 2:23:41 AM6/30/21
to mapi...@googlegroups.com

Hi

 

Use this line:

Run Command "run program " + Chr$(34) + "exloc" + Chr$(34) + " " + Chr$(34) + "'path'\dcprint.xlsm" + Chr$(34)

instead of this line:

run program exloc + "'path'\dcprint.xlsm" (in this instance updates and prints dcprint)

 

It’s a wild guess as I can’t see how that should make a real difference.

I do assume that the string 'path' will be replace with the real path in your code, right?

You may also want to ensure that you have a space between the exloc and the xlsm file.

You can try to print this before executing it to ensure it looks fine:

 

Print "run program " + Chr$(34) + "exloc" + Chr$(34) + " " + Chr$(34) + "'path'\dcprint.xlsm" + Chr$(34)

 

Peter Horsbøll Møller

www.precisely.com

 

Peter Horsbøll Møller
Principal Sales Engineer - Distinguished Engineer

 

StA

unread,
Jun 30, 2021, 7:45:49 PM6/30/21
to MapInfo-L
Good evening Peter and thank you for your response and explanation,
I am afraid after compiling and running the script I am getting the same error, but I really don't understand why, evetrhing else seems to work fine it is just the part where the user exports the results/selection in either excel or word where it throws this error.
Once again thank you very much for your time and effort in helping me resolve this
Kind Regards
Stathis

StA

unread,
Jul 7, 2021, 7:00:04 AM7/7/21
to MapInfo-L
Good morning Peter and thank you for your help after trying quite a few things I managed to reolve the error, it was possibly related with the location of the file/access rights.
But now it is resolved so thank you very much for your help and input
Kind Regards

Stathis

Reply all
Reply to author
Forward
0 new messages