LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Trouble with UserName

1. Is there a 'Standard' term for User and User Name? I'm trying to save a
file to a user's desktop. and have written the following, which grinds to a
stop in the If statement at the bottom. How should I write this?
2. I want to also copy the contents of a textbox into the new file. The
textbox is called "Textbox 1" in the Excel Spreadsheet. How can I bring it
across?

Thanks
Jim Berglund


Sub CreateCallList() 'Create a new file on the Desktop
Dim wsCList As Worksheet
Dim wb As Workbook
Dim Textbox_1 As TextBox
Dim Response, UserName As String

Application.ScreenUpdating = False
Set wb = ThisWorkbook
Set wsCList = wb.Worksheets("Call List")

wsCList.Activate
With ActiveSheet

.Range("$A:$G").Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme,
Operation:=xlNone _
, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

Response = MsgBox("This will paste these values into a new worksheet
on your Desktop called Call List.xls", vbOKCancel)
If Response = vbOK Then
ActiveWorkbook.SaveAs Filename:="C:\Users\" & UserName &
"\Desktop\Call List1.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False,
_
CreateBackup:=False
End If

End With
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
environ username vs. application username jatman Excel Programming 4 May 28th 09 08:40 AM
Username Oldjay Excel Programming 13 April 25th 08 07:50 PM
NT Username ceemo Excel Discussion (Misc queries) 4 August 2nd 05 04:39 PM
UserName Myriam Excel Programming 12 April 20th 05 08:18 PM
Username Lawlera[_2_] Excel Programming 3 December 23rd 03 09:21 AM


All times are GMT +1. The time now is 12:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"