having troubles with an Excel Macro saving to C: on Windows 10

Posted on 2016-10-06
Last Modified: 2016-10-06
I have this certain file from the Bank to do payroll stuff. (Very hokey but I won't get in to that).

At the end of the process, I invoke a Macro that saves certain data to a folder on the C: Drive.

The macro always gives the following error:
screenshot 1
I'm suspecting that there is some kind of security issue going on that I cannot save to the C: drive. If so, please how can I circumvent that.

-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  

As an FYI, here is a screenshot of the area of the macro that causes the problem. The particular folder in question, namely "C:/Produbanco/" is indeed set up.

-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  

I've had several very frustrating talks on the phone with the support people at the bank to no avail.

Please help. Thanks! :D
Question by:gregholl
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 21

Expert Comment

ID: 41832828
Make sure that dirCambio is a proper string for a full file spec.  I'd display it in a message box surrounded by <> to confirm that it is what you expect and doesn't have any spaces or other issues.

Author Comment

ID: 41832883
Hi. There is no problem with the Macro itself. This was not made by me. I would rather not mess with it. This exact same Excel document works just fine on my old computer which was running Windows Server Edition 2012. I transfer the Excel file to the new computer under Windows 10, and the macro gets this error.

How do I make it so that, by default, the macro can save things to the C:  drive?
LVL 54

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 41832899
Hi Greg,
What is in the variable nomArch and what is its type? Note that + is being used as the concatenation operator rather than &. Regards, Joe
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.


Author Comment

ID: 41832920
Joe Winograd: Please let's not deal with the syntax of the macro. It's fine, because it works on other computers. I honestly think, as mentioned before, that I need to activate the C: drive somehow to allow writing to it without any security warning.

Thanks Joe, but I really don't think we need to get into macro syntax and I don't really understand it anyway.
LVL 54

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 41832936
You said in the original question, "The particular folder in question, namely "C:/Produbanco/" is indeed set up." The point is, that is not the folder in question. The folder in question is the concatenation of C:\Produbanco\ (I fixed your forward slashes to backslashes) with whatever is in the variable nomArch. So the subfolder that it is trying to write to may, indeed, not exist on your new computer, but does exist on your old computer. Hence, it throws the "Path/File access error" on the new computer but not the old one. Go to your old computer and look at the subfolders of C:\Produbanco\ — make sure they exist on the new computer, and if not, create them. Regards, Joe

Author Comment

ID: 41832997
Sorry about the slashes.

Here's some screen shots from the old computer.

a) I deleted the folder called C:\Produbanco\ just for this exercise. I try to run the Macro. I get this error:
1(It says: "Produbanco folder doesn't exist; please create it).

b) So I make the folder, as requested. No sub folder or anything.
c) Now I run the macro again, and it works just fine.
3(It says: "The Provider payment file was successfully created at C:\Produbanco\pagos fin sep.txt)

-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  

regarding nomArch and the concatenation:
The macro works like this. I put in a certain cell the name I want the file to have. It this case, I entered the text:  "pagos fin sep". Then the concatenate puts it all together and I get: C:\Produbanco\pagos fin sep.txt

I don't honestly know what nomArch means but I figure that it's taking the name I put in from that particular cell.

-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  

Now.... replay with this exact same Excel document, on the same version of Excel, but on the new computer and I get the error as shown in the original question.

Hope that sheds some light to be able to troubleshoot this issue.
LVL 43

Accepted Solution

Saqib Husain, Syed earned 500 total points
ID: 41833004
For testing

if you have a D drive then try changing C: to D: on the highlighted line.

Author Closing Comment

ID: 41833009
Yup. That did it. All fine now. sooooo. happy!  ;)

LVL 54

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 41833096
Sorry...away from the computer for a while.

> I don't honestly know what nomArch means

Well, if the concatenation is resulting in C:\Produbanco\pagos fin sep.txt, then nomArch is obviously the file name, not a subfolder.

I thought you wanted to get it working on the C: drive ("I would rather not mess with it [the macro]"), but if you're OK with changing the macro to work on D: (or E: or H: or whatever), that's great. Still doesn't answer the question of why it's not working on C: — but if you're happy, that's all that matters. And I was happy to try to help you. Regards, Joe

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
Cancel future meetings from user mailboxes in Office 365 using Remove-CalendarEvents
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question