Hello all-powerful MrExcel board,
I have been dabbling with VBA in Excel for a few years and recently rewrote several routines to make them more bulletproof. Here is what I am attempting to do:
I have been successful with all steps but #5. Yesterday I tried using the macro recorder to generate the proper code for what I was failing to do myself. The macro recorder appeared to work perfectly with the exception of one line:
I assume this line would properly crop my first page header image properly if I knew what to do with it. I have been unable to execute this line in anyway. I believe this line is the first page header equivalent of:
The lines above successfully removes 0.25" from the top of the image on the second page header.
Changing the above lines to this:
Results in: Run-Time error '438': Object doesn't support this property or method.
Attempting to execute the Macro Recorder line of:
Results in: Run-time error '1004': The formula you typed contains an error.
Google searches of my issues have come up empty. Attempts to use ExecuteExcel4Macro properly using the limited data on: Application.ExecuteExcel4Macro Method (Excel) were also unsuccessful. Any help would be appreciated.
I am running Office Professional Plus 2010 (32-bit) on Windows 7 Professional SP1 (64-bit).
Thank you very much for your time,
Brian
I have been dabbling with VBA in Excel for a few years and recently rewrote several routines to make them more bulletproof. Here is what I am attempting to do:
- Create a new worksheet
- Copy the information as needed from another worksheet
- Format the new sheet
- Insert one image into the first page header
- Crop the first page header image
- Insert a second image into the subsequent pages' headers
- Crop the second pages' header image
I have been successful with all steps but #5. Yesterday I tried using the macro recorder to generate the proper code for what I was failing to do myself. The macro recorder appeared to work perfectly with the exception of one line:
Code:
ExecuteExcel4Macro "(16,774,,,,,,,,,18.01)"
I assume this line would properly crop my first page header image properly if I knew what to do with it. I have been unable to execute this line in anyway. I believe this line is the first page header equivalent of:
Code:
With Sheets(1).PageSetup.CenterHeaderPicture
.Height = 774
.CropTop = 18.01
End With
The lines above successfully removes 0.25" from the top of the image on the second page header.
Changing the above lines to this:
Code:
With Sheets(1).PageSetup.FirstPage.CenterHeaderPicture
.Height = 774
.CropTop = 18.01
End With
Results in: Run-Time error '438': Object doesn't support this property or method.
Attempting to execute the Macro Recorder line of:
Code:
ExecuteExcel4Macro "(16,774,,,,,,,,,18.01)"
Results in: Run-time error '1004': The formula you typed contains an error.
Google searches of my issues have come up empty. Attempts to use ExecuteExcel4Macro properly using the limited data on: Application.ExecuteExcel4Macro Method (Excel) were also unsuccessful. Any help would be appreciated.
I am running Office Professional Plus 2010 (32-bit) on Windows 7 Professional SP1 (64-bit).
Thank you very much for your time,
Brian