If I understand you correctly, it is NOT a VBA problem: when connecting through remote desktop, you can’t copy a worksheet interactively either. Or am I completely off?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Unable to copy sheet (VBA/Excel/97sr2)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Unable to copy sheet (VBA/Excel/97sr2)
- This topic has 14 replies, 4 voices, and was last updated 20 years, 5 months ago.
Viewing 2 reply threadsAuthorReplies-
WSase001
AskWoody LoungerJanuary 14, 2005 at 10:53 am #921908That seems to be it Hans,
On normal desktop I can open the workbook, I select the command button and a new copy of the worksheet is created as a new workbook
On remote desktop I can open the workbook, I select the command button – error 1004 appears. Worksheet is not apparently copy’able when opening the workbook in remote desktop.I think I will have to work around it by creating new workbook and copying all of the sheets data over to the new workbook…unless anyone knows different?
Alan
-
WSase001
AskWoody LoungerJanuary 14, 2005 at 10:53 am #921909That seems to be it Hans,
On normal desktop I can open the workbook, I select the command button and a new copy of the worksheet is created as a new workbook
On remote desktop I can open the workbook, I select the command button – error 1004 appears. Worksheet is not apparently copy’able when opening the workbook in remote desktop.I think I will have to work around it by creating new workbook and copying all of the sheets data over to the new workbook…unless anyone knows different?
Alan
-
WSase001
AskWoody LoungerJanuary 14, 2005 at 11:07 am #921907(Thread moved from VB/VBA to Excel by HansV because it turned out not to be VBA specific.)
Posted here instead of Excel because I see it more of a vba problem, but if needs moving please advise.
Excel workbook, has one sheet for which there is a command button with macro:
Sub Copy_Sheet()
Dim strMySheet As String
strMySheet = ActiveSheet.Name
Sheets(strMySheet).Copy
End SubIt is very straight forward sequence but believe me, the guys operating this worksheet are not able to copy a sheet reliably, hence the command button.
When the workbook is used under normal circumstances the command works fine and a new worksheet is created.
However, when connecting through remote desktop the code errors at the .copy line withRun Time error 1004
Copy method of worksheet class failedAlso, strangely enough, when I manually drag and drop a copy of the worksheet into the frame surround area, it just doesn’t copy.
If I right mouse the worksheet tab and go to make a copy in a new workbook, again, nothing happens.
Any suggestions?
TIA
Alan
Cheshire
UK -
WSsdckapr
AskWoody LoungerJanuary 14, 2005 at 12:08 pm #921916In XL97 there is a bug and some things are NOT allowed when an object has the focus.
Try adding the line “Activecell.select” as the first line of your code. This ensures that the object which calls the macro does not have the focus.
Sub Copy_Sheet()
Activecell.select
Dim strMySheet As String
strMySheet = ActiveSheet.Name
Sheets(strMySheet).Copy
End SubSteve
-
WSase001
AskWoody Lounger -
WSsdckapr
AskWoody Lounger -
WSase001
AskWoody LoungerJanuary 14, 2005 at 9:11 pm #922193No, workbook is not protected.
I had normal desktop (XP OS) running and opened the file, ran through all of the code succesfully creating copy sheets as required.
I closed the file and opened a remote desktop session, opened the same file through this session, and the code error’d.
T’is most frustrating.
I suspect users rights?alan
-
WSAndrewO
AskWoody LoungerJanuary 16, 2005 at 5:05 pm #922381 -
WSase001
AskWoody LoungerJanuary 17, 2005 at 12:13 pm #922509(Edited by HansV to make URL clickable – see Help 19)
In depth search on MS revealed:
http://support.microsoft.com/default.aspx?…kb;en-us;178510%5B/url%5DBascially tellin gme that the normal method of referencing needs to be more precise and complete.
I used the method and I was able to add new workbooks, but…..I cannot SEE those workbooks.
When I go to log off the remote desktop I am prompted to save the as yet unseen workbooks. Excel is not running and I have no other application open.Sub Copy_Sheet() Dim strMySheet As String Dim xlApp As Excel.Application Dim xlSheet As Excel.Worksheet Set xlApp = CreateObject("Excel.Application") xlApp.Workbooks.Add End Sub
Can I reveal these new workbooks by repainting or refreshing somehow?
Thanks
Alan
Cheshire
UK -
WSHansV
AskWoody LoungerJanuary 17, 2005 at 1:42 pm #922511When you start an instance of Excel this way, it is invisible. The prompt to save the workbooks is issued by Excel, which has remained in memory invisibly because you haven’t told it to quit. You can make Excel visible by
Set xlApp = CreateObject(“Excel.Application”)
xlApp.Visible = True -
WSase001
AskWoody Lounger
-
-
-
WSsdckapr
AskWoody Lounger
-
-
-
WSase001
AskWoody Lounger
WSsdckapr
AskWoody LoungerJanuary 14, 2005 at 12:08 pm #921917In XL97 there is a bug and some things are NOT allowed when an object has the focus.
Try adding the line “Activecell.select” as the first line of your code. This ensures that the object which calls the macro does not have the focus.
Sub Copy_Sheet()
Activecell.select
Dim strMySheet As String
strMySheet = ActiveSheet.Name
Sheets(strMySheet).Copy
End SubSteve
Viewing 2 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Have Copilot there but not taking over the screen in Word
by
CWBillow
5 hours, 4 minutes ago -
4 Strange Facts About Тостер За Сандвичи (Awaiting moderation)
by
rosalinepettey6
11 hours, 15 minutes ago -
Windows 11 blocks Chrome 137.0.7151.68, 137.0.7151.69
by
Alex5723
19 hours, 38 minutes ago -
Are Macs immune?
by
Susan Bradley
17 hours, 1 minute ago -
HP Envy and the Function keys
by
CWBillow
3 hours, 22 minutes ago -
Microsoft : Removal of unwanted drivers from Windows Update
by
Alex5723
1 day, 6 hours ago -
MacOS 26 beta 1 dropped support for Firewire 400/800
by
Alex5723
1 day, 7 hours ago -
Unable to update to version 22h2
by
04om
17 hours, 54 minutes ago -
Windows 11 Insider Preview Build 26100.4482 (24H2) released to Release Preview
by
joep517
1 day, 14 hours ago -
Windows 11 Insider Preview build 27881 released to Canary
by
joep517
1 day, 14 hours ago -
Very Quarrelsome Taskbar!
by
CWBillow
1 day ago -
Move OneNote Notebook OFF OneDrive and make it local
by
CWBillow
2 days, 3 hours ago -
Microsoft 365 to block file access via legacy auth protocols by default
by
Alex5723
1 day, 16 hours ago -
Is your battery draining?
by
Susan Bradley
3 hours, 42 minutes ago -
The 16-billion-record data breach that no one’s ever heard of
by
Alex5723
3 hours, 3 minutes ago -
Weasel Words Rule Too Many Data Breach Notifications
by
Nibbled To Death By Ducks
2 days, 7 hours ago -
Windows Command Prompt and Powershell will not open as Administrator
by
Gordski
1 day, 15 hours ago -
Intel Management Engine (Intel ME) Security Issue
by
PL1
1 day, 15 hours ago -
Old Geek Forced to Update. Buy a Win 11 PC? Yikes! How do I cope?
by
RonE22
1 day, 8 hours ago -
National scam day
by
Susan Bradley
14 hours, 53 minutes ago -
macOS Tahoe 26 the end of the road for Intel Macs, OCLP, Hackintosh
by
Alex5723
1 day, 11 hours ago -
Cyberattack on some Washington Post journalists’ email accounts
by
Bob99
3 days, 8 hours ago -
Tools to support internet discussions
by
Kathy Stevens
1 day, 21 hours ago -
How get Group Policy to allow specific Driver to download?
by
Tex265
2 days, 23 hours ago -
AI is good sometimes
by
Susan Bradley
3 days, 15 hours ago -
Mozilla quietly tests Perplexity AI as a New Firefox Search Option
by
Alex5723
3 days, 5 hours ago -
Perplexity Pro free for 12 mos for Samsung Galaxy phones
by
Patricia Grace
4 days, 16 hours ago -
June KB5060842 update broke DHCP server service
by
Alex5723
4 days, 14 hours ago -
AMD Ryzen™ Chipset Driver Release Notes 7.06.02.123
by
Alex5723
4 days, 18 hours ago -
Excessive security alerts
by
WSSebastian42
3 days, 9 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.