Solved

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

Posted on 2016-10-06
9
58 Views
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.

screenshot2
-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  

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

Please help. Thanks! :D
0
Comment
Question by:gregholl
9 Comments
 
LVL 21

Expert Comment

by:CompProbSolv
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.
0
 
LVL 1

Author Comment

by:gregholl
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?
0
 
LVL 53

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
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 1

Author Comment

by:gregholl
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.
0
 
LVL 53

Expert Comment

by:Joe Winograd, EE MVE
ID: 41832936
Greg,
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
0
 
LVL 1

Author Comment

by:gregholl
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.
2
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.
0
 
LVL 43

Accepted Solution

by:
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.
0
 
LVL 1

Author Closing Comment

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

Thanks
0
 
LVL 53

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
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

In the market for a new backup solution for Windows Server 2016? Follow these guidelines to get the most bang for your buck.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

820 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