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
-
Move OneNote Notebook OFF OneDrive and make it local
by
CWBillow
58 minutes ago -
Microsoft 365 to block file access via legacy auth protocols by default
by
Alex5723
2 hours, 16 minutes ago -
Is your battery draining?
by
Susan Bradley
1 hour, 41 minutes ago -
The 16-billion-record data breach that no one’s ever heard of
by
Alex5723
4 hours, 13 minutes ago -
Weasel Words Rule Too Many Data Breach Notifications
by
Nibbled To Death By Ducks
4 hours, 49 minutes ago -
Windows Command Prompt and Powershell will not open as Administrator
by
Gordski
8 hours, 4 minutes ago -
Intel Management Engine (Intel ME) Security Issue
by
PL1
11 hours, 1 minute ago -
Old Geek Forced to Update. Buy a Win 11 PC? Yikes! How do I cope?
by
RonE22
1 hour, 19 minutes ago -
National scam day
by
Susan Bradley
4 hours, 14 minutes ago -
macOS Tahoe 26 the end of the road for Intel Macs, OCLP, Hackintosh
by
Alex5723
1 hour, 30 minutes ago -
Cyberattack on some Washington Post journalists’ email accounts
by
Bob99
1 day, 5 hours ago -
Tools to support internet discussions
by
Kathy Stevens
1 day, 12 hours ago -
How get Group Policy to allow specific Driver to download?
by
Tex265
20 hours, 58 minutes ago -
AI is good sometimes
by
Susan Bradley
1 day, 13 hours ago -
Mozilla quietly tests Perplexity AI as a New Firefox Search Option
by
Alex5723
1 day, 3 hours ago -
Perplexity Pro free for 12 mos for Samsung Galaxy phones
by
Patricia Grace
2 days, 13 hours ago -
June KB5060842 update broke DHCP server service
by
Alex5723
2 days, 11 hours ago -
AMD Ryzen™ Chipset Driver Release Notes 7.06.02.123
by
Alex5723
2 days, 15 hours ago -
Excessive security alerts
by
WSSebastian42
1 day, 6 hours ago -
* CrystalDiskMark may shorten SSD/USB Memory life
by
Alex5723
3 days, 1 hour ago -
Ben’s excellent adventure with Linux
by
Ben Myers
18 hours, 33 minutes ago -
Seconds are back in Windows 10!
by
Susan Bradley
2 days, 12 hours ago -
WebBrowserPassView — Take inventory of your stored passwords
by
Deanna McElveen
1 day, 6 hours ago -
OS news from WWDC 2025
by
Will Fastie
16 hours, 17 minutes ago -
Need help with graphics…
by
WSBatBytes
1 day, 20 hours ago -
AMD : Out of Bounds (OOB) read vulnerability in TPM 2.0 CVE-2025-2884
by
Alex5723
3 days, 16 hours ago -
Totally remove or disable BitLocker
by
CWBillow
2 days, 16 hours ago -
Windows 10 gets 6 years of ESU?
by
n0ads
2 days, 19 hours ago -
Apple, Google stores still offer China-based VPNs, report says
by
Nibbled To Death By Ducks
4 days, 3 hours ago -
Search Forums only bring up my posts?
by
Deo
8 hours, 33 minutes 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.