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
LVL 20

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 52

Expert Comment

by:Joe Winograd, EE MVE
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

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.
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

LVL 52

Expert Comment

by:Joe Winograd, EE MVE
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 52

Expert Comment

by:Joe Winograd, EE MVE
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
What to do when Windows Update is not working correctly? What tools can I use to detect the cause of the malfunction problem? What does this numeric error code mean? These and other questions that you have been asking in the past are answered here (…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

948 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now