I have a Worksheet.Activate macro for pasting information that has been working for over a year now. I have multiple users using the macro with no problems. Recently one user is having this error whenever they paste into this worksheet that activates the macro:
Run-time error '1004': 'C:\Users\xxxx\Documents\Master_Macros.xlsb' could not be found. Check the spelling of the file name, and verify that the file location is correct.
They have never had this issue before and as far as I know he hasn't done anything abnormal. The macro is located in the typical XLSTART folder, not the Documents folder. The macro file also includes other macros that are executing perfectly fine for this user. Excel is suddenly looking for the macro file in the Documents folder for this one Worksheet.Activate macro. I have spent some time googling, and I don't know if it is my keyword choice or what, I cannot find a solution.
The macro is run using this line:
Application.Run ("Master_Macros.xlsb!'C_Tool_Paste_Window.CTool_LineFix'")
Any help would be appreciated!
I had similar problem when I installed Service Pack.
If the users are accessing files from different computers,
make sure they all have same service pack installed
Related
I am new to VBA and learning a ton using these forums but I am stumped on how I should tackle this problem I am coming across.
The Problem:
I am setting up VBA for our workplace physical inventory that we do 1 time per quarter. I have so far got my code to create a new folder based on today's date, and then the code will copy and paste all the files and subfolders from the master folder into this newly created folder. The issue I am having is that the excel file we use for our physical inventory, is linked to various other excel workbooks (which can be found in the sub folders under the master folder), so when the code copies and pastes the files, the file paths change and break the links to the various workbooks. Ideally, I am just trying to get my code to find and replace the existing "master template" folder path, to the newly created folder path as mentioned above. That way, all that needs to be done is to click the button that creates the new physical inventory folder with the master templates, then it will find and replace all existing external paths, with the new folder path to enable the links to continue working. If one of you master excel wizards would be so kind to help a rookie out, I would greatly appreciate it. I am not at work now, but I can provide the VBA code I have created thus far tomorrow. I am also always open to new ideas as to how I can do this in a simpler manner if find and replace isn't necessary. I have tried to do fix links command and that doesn't work without having to go through each workbook and manually changing path locations.
Thank you once again for all your help.
if code is not needed, there is a free tool that I came across which removed all broken links in the Excel workbook:
https://youtu.be/FyCNWE3_YpY
We have wrote an application with C++/Qt which reads some data from multiple excel files and then generate a word report. We have used benefits of Office automation server to read/find and copy data from excel files and write them into a single word file.
The application works fine without any significant problem in my office computers. Yesterday I've decided to copy the app into my laptop which has same OS and office version. After running the app, it seems that somethings wrong my OS/Office. None of the data are copied into word file. After debugging I've figured out that the app actually can read/write office files but failed to call CopyPicture method of automation!!!
I wanted to copy the range as picture, so I have used "CopyPicture" method. but it seems that the vba fails to call copyPicture on my laptop.
I'll be very appreciated for any hints. Thank you
I've found the problem and it's with excel docs which are used to copy data from. In these files, there are some embeddedCharts. after removing these charts the code works fine!!!! (very odd). Anyway, I've tried to make excel file visible in order to see if the operation goes well or not. After running (with embeddedCharts) the code worked fine (more odd!!)
excel->dynamicCall("Visible", true );
I don't know the reason but with making excel file visible, the error with copyPicture is gone!
I have encountered a strange problem, I made macro about a year ago and it is being used every month without problems. Yesterday my boss told me, he cannot use it anymore, that it gives him some errors. I now tried the macro on 8 computers and the macro ran perfectly. Why is it that macro runs on everyone else's computer, except for my boss.
The line it breaks on
Windows("MyxlsbFile").Activate
And the error given is
Run-time error '9': Subscript out of range.
Whether or not you can leave off the file extension when calling (eg)
Windows("MyxlsbFile")
or
Workbooks("MyxlsbFile")
depends on whether the Windows Explorer setting "hide extensions for known file types" has been checked or not: if file extensions are shown in Windows Explorer then you must include the extension when calling WorkBooks().
I'm guessing this is the issue on the one PC where you have the problem.
Including the file extension always works (as long as there's no other error of course)
Right now we have a program that opens all of the word files in a folder and adds some information to the footer. After switching from Windows XP and Word 2003 to Windows 7 and Word 2007 we have started getting the following error:
Run-time error '5096':
EOALPHABETICARABICARABICABJADARABICALPHABAHTTEXTCAPSCA
(c:\Users...\Content.MSO\8BE508C6.docx)
It occurs at random in any of the files (you can be 10 files in or 100). I thought that it might be a problem with the files being on a network drive so I modified the program to copy each file locally first, add the footer to that copy, and then copy it back out to the network. However, that didn't seem to work. I'm looking for any suggestions on how to fix the problem or possibly rewrite the solution. However, I need to keep the solution in VBA since this app is part of a bigger suite which in not ready for a .NET re-write.
As it turns out I was able to workaround this problem by copying the word files locally, running the main code on the local copies, then copying them back out to the network. It didn't seem to be working at first because the user's machine on which I tested it did not have the most recent version of the program.
Adding this note for those still looking for answers to this error...
I have a macro that creates several docs from one that is open based on sections in the main document.
I was getting the Run-time error '5096' and was an able to find any solutions that worked.
Upon further examination while debugging the code I discovered that while pulling data out of the main doc and building a file name that there was a carriage return after the file name and before the extension. After adding a replace statement to remove carriage returns I am able to process documents all day without an error.
I have found that the error is caused by the total number of characters in the file name is too long. This usually occurs when manipulating file names and the full path is set in the variable. I will manually chop pieces out of real long names to force it to work.
I suppose if I were smart, I'd move into the directory and just deal with the file names without the directory prepended to the name.
I'm pulling my hair out because I've run into the following problem with one of my clients:
My program uses extensive VBA automation in Word. Macros are saved in a specific Word template that is attached to each document. Some of the macros save the current document to a temporary folder under [User]/AppData/Roaming/... for further processing.
The client is using Win7 with Office2007 (Student edition). On the computer in question I keep getting an error with something like "No permission to save the file" (can't give exact error message because I've translated it from my language to English)
This happens when the macro tries to "SaveAs" the document.
The strange thing is that it happens only 8 out of 10 times - and not all the time. There are no special permissions set for the temporary folder I'm trying to save to.
I've tried changing Word security settings, tried adding the folder to the trusted folders list, tried using a different folder - to no avail.
The client's computer has Norton Antivirus (or Internet Security, I dunno) installed but temporary disabling it didn't solve the problem. (I know I should only be sure after a full uninstall but I can't do that on the client's comp)
Any help is appreciated!
Update: I've since found the exact error message in English: "Word cannot complete the save due to a file permission error."
I'm now looking on the web for similar forum posts but if you guys know something, please let me know. Thanks!
Is an antivirus or similar program running? On my development computers many similar problems went away when I changed from (vendor "X" security bundle) to ESET.