ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro not running properly when shortcut is used (https://www.excelbanter.com/excel-programming/411988-macro-not-running-properly-when-shortcut-used.html)

Aviashn

Macro not running properly when shortcut is used
 
I've written a macro that formats data then copies a range to an
email. It works fine when run from the VBE where I did all my
testing. When I moved it onto the end-users desktop and assigned a
shortcut key it stopped working properly. If run by way of the
shortcut key it runs through the first few lines of code and then
exits the macro completely.

It still works if I go to ToolsMacroRun

Set wbCurr = ActiveWorkbook
Set wsRaw = wbCurr.Worksheets(1)
sTempFilePath = "R:\CDR\Cust Serv\DailyStatsTemplate
\DailyStatsTemplate.xls"
Set wbTemplate = Workbooks.Open(sTempFilePath)

After opening the template workbook the macro ends completely.


I've never run into anything like this. Any help would be appreciated.

Dave Peterson

Macro not running properly when shortcut is used
 
Remove the shiftkey from the shortcut combination and try it out.

Aviashn wrote:

I've written a macro that formats data then copies a range to an
email. It works fine when run from the VBE where I did all my
testing. When I moved it onto the end-users desktop and assigned a
shortcut key it stopped working properly. If run by way of the
shortcut key it runs through the first few lines of code and then
exits the macro completely.

It still works if I go to ToolsMacroRun

Set wbCurr = ActiveWorkbook
Set wsRaw = wbCurr.Worksheets(1)
sTempFilePath = "R:\CDR\Cust Serv\DailyStatsTemplate
\DailyStatsTemplate.xls"
Set wbTemplate = Workbooks.Open(sTempFilePath)

After opening the template workbook the macro ends completely.

I've never run into anything like this. Any help would be appreciated.


--

Dave Peterson

Aviashn

Macro not running properly when shortcut is used
 
Thanks Dave, I'll give that a try.


All times are GMT +1. The time now is 07:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com