Macro to Import Worksheet with Images Corrupts Excel File

acsmith944

New Member
Joined
Aug 4, 2014
Messages
1
This is a long post, I'm trying to give as much information as possible, but I'll try to have the most important info first. I need some assistance with a workaround for importing a worksheet with images.

I have an excel application (PC, 2010) that will be used on a network drive. I've written a macro that imports a template analysis worksheet (from a .xlsx file) into the application. This macro exists solely to take care of a couple tedious tasks and make the users life easier. The macro will run with no errors, but there are 2 issues after it runs:
1) If the macro first copies the template file into the application and then renames the images, the images show a "Cannot display image" error message.
2) If the macro makes all the changes to the .xlsx file and then imports the worksheet as the final step, the application cannot be saved due to the file being damaged. Excel will attempt to repair the file but the damage is too extensive.

As I have said, the macro runs without any issue, so I am not posting it (it is rather long and likely to not be useful). I use the worksheet.copy method, but using the move method does not change any of the outcomes. I have tried deleting the images from the worksheet inside the application and the cutting and pasting from the .xlsx worksheet, but the outcomes did not change. Is there a way to copy these images from the .xlsx file so that the images inside the application will not refer to the .xlsx file? I believe I need the images to store themselves inside the application, but I'm unsure of how to make that happen. The images were copied in using SnagIt, which allows me to select a portion of my screen and copy and paste the image.

About the macro:
1) Renames the images on the sheet to a naming convention (other macros will refer to images using this naming convention)
2) Creates a named range for cells with "MS" as the cell value (other macros will refer to these cells to locate information and transfer that information elsewhere)
3) Formats the border around these MS cells (visually appealing)

About the application:
The application holds "template" analysis worksheets that it can use to generate reports. Each template is a different analysis and each analysis can be applied to a small subset of generic problems. These templates contain images that were copied and pasted into the worksheet from a program called SnagIt (works like OSX's grab, can get make a screen selection, edit it, and then copy and paste onto the worksheet). To make the application modular, users can create a template and then use this import macro to add their new analysis template. The macro makes the necessary modifications for the template to function properly inside the application instead of the user having to manually do this (it would be very tedious).

Thanks,
Andy
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,225,554
Messages
6,185,632
Members
453,310
Latest member
fish5748

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top